* This function is called when one of the mission's UFOs has finished it's time on the ground. * It takes care of sending the UFO to the next waypoint and marking them for removal as required. * It must set the game data in a way that the rest of the code understands what to do. * @param ufo The UFO that reached it's waypoint. * @param engine The game engine, required to get access to game dat
| 518 | * @param globe The earth globe, required to get access to land checks. |
| 519 | */ |
| 520 | void AlienMission::ufoLifting(Ufo &ufo, Game &engine, const Globe &globe) |
| 521 | { |
| 522 | switch (ufo.getStatus()) |
| 523 | { |
| 524 | case Ufo::FLYING: |
| 525 | assert(0 && "Ufo is already on the air!"); |
| 526 | break; |
| 527 | case Ufo::LANDED: |
| 528 | { |
| 529 | // base missions only get points when they are completed. |
| 530 | if (_rule.getPoints() > 0 && _rule.getType() != "STR_ALIEN_BASE") |
| 531 | { |
| 532 | addScore(ufo.getLongitude(), ufo.getLatitude(), engine); |
| 533 | } |
| 534 | ufo.setAltitude("STR_VERY_LOW"); |
| 535 | ufo.setSpeed((int)(ufo.getRules()->getMaxSpeed() * ufo.getTrajectory().getSpeedPercentage(ufo.getTrajectoryPoint()))); |
| 536 | } |
| 537 | break; |
| 538 | case Ufo::CRASHED: |
| 539 | // Mission expired |
| 540 | ufo.setDetected(false); |
| 541 | ufo.setStatus(Ufo::DESTROYED); |
| 542 | break; |
| 543 | case Ufo::DESTROYED: |
| 544 | assert(0 && "UFO can't fly!"); |
| 545 | break; |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | /** |
| 550 | * The new time must be a multiple of 30 minutes, and more than 0. |
no test coverage detected