X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FUniverse.cpp;h=c5bb915805a324cd240541ffb2f12173cf44d39b;hb=1cb5ed22d7772abe6f9893be90f26f46dbde39f7;hp=9f9efe627839eb4be29d33ed2751dc225fe0250a;hpb=11306935dbf7213d583222ce239985e1b3f180bf;p=space.git diff --git a/src/world/Universe.cpp b/src/world/Universe.cpp index 9f9efe6..c5bb915 100644 --- a/src/world/Universe.cpp +++ b/src/world/Universe.cpp @@ -18,31 +18,15 @@ 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; - } - while (e.pos.x < 0) { - e.pos.x += areaSize.x; - --e.area.x; - } - while (e.pos.y > areaSize.y) { - e.pos.y -= areaSize.y; - ++e.area.y; - } - while (e.pos.y < 0) { - e.pos.y += areaSize.y; - --e.area.y; - } + for (Ship &s : ships) { + s.Update(delta); } }