X-Git-Url: http://git.localhorst.tv/?p=space.git;a=blobdiff_plain;f=src%2Fworld%2FUniverse.cpp;h=6f2e5c18091ff5b4d4cc1c24d1d4e489e6e97ef5;hp=9f9efe627839eb4be29d33ed2751dc225fe0250a;hb=699437a474de8b87ccb6749d44adf740e680d620;hpb=1129b8ac89f1e614f69793227ccec90157708aea diff --git a/src/world/Universe.cpp b/src/world/Universe.cpp index 9f9efe6..6f2e5c1 100644 --- a/src/world/Universe.cpp +++ b/src/world/Universe.cpp @@ -18,30 +18,30 @@ Universe::~Universe() { } -Entity *Universe::AddEntity(const Entity &e) { - entities.emplace_back(e); - return &entities.back(); +Ship *Universe::AddShip(const Ship &s) { + ships.emplace_back(s); + return &ships.back(); } void Universe::Update(float delta) { - for (Entity &e : entities) { - e.Update(delta); - while (e.pos.x > areaSize.x) { - e.pos.x -= areaSize.x; - ++e.area.x; + for (Ship &s : ships) { + s.Update(delta); + while (s.pos.x > areaSize.x) { + s.pos.x -= areaSize.x; + ++s.area.x; } - while (e.pos.x < 0) { - e.pos.x += areaSize.x; - --e.area.x; + while (s.pos.x < 0) { + s.pos.x += areaSize.x; + --s.area.x; } - while (e.pos.y > areaSize.y) { - e.pos.y -= areaSize.y; - ++e.area.y; + while (s.pos.y > areaSize.y) { + s.pos.y -= areaSize.y; + ++s.area.y; } - while (e.pos.y < 0) { - e.pos.y += areaSize.y; - --e.area.y; + while (s.pos.y < 0) { + s.pos.y += areaSize.y; + --s.area.y; } } }