Guest User

Untitled

a guest
Feb 15th, 2014
1,770
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void TWorld::ProcessShips() {
  2.     QVector<TShip> newShips;
  3.     newShips.reserve(Ships.size());
  4.  
  5.     for (size_t i = 0; i < (size_t)Ships.size(); ++i) {
  6.         TShip& ship = Ships[i];
  7.         QPointF v1 = Rule1(i);
  8.         QPointF v2 = Rule2(i);
  9.         QPointF v3 = Rule3(i);
  10.         QPointF v4 = Rule4(i);
  11.         QPointF v5 = Rule5(i);
  12.         ship.Speed = ship.Speed + v1 + v2 + v3 + v4 + v5;
  13.         LimitSpeed(ship.Speed);
  14.  
  15.         ship.Position += ship.Speed;
  16.         if (!ProcessCollision(ship) &&
  17.             ship.Position.x() >= 0 && ship.Position.x() < WORLD_WIDTH &&
  18.             ship.Position.y() >= 0 && ship.Position.y() < WORLD_HEIGHT)
  19.         {
  20.             newShips.push_back(ship);
  21.         }
  22.     }
  23.     Ships.swap(newShips);
  24. }
RAW Paste Data