]> git.localhorst.tv Git - space.git/blobdiff - src/world/Universe.cpp
added autopilot that sucks
[space.git] / src / world / Universe.cpp
index 9f9efe627839eb4be29d33ed2751dc225fe0250a..c5bb915805a324cd240541ffb2f12173cf44d39b 100644 (file)
@@ -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);
        }
 }