MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / ufoLifting

Method ufoLifting

src/Savegame/AlienMission.cpp:520–547  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

518 * @param globe The earth globe, required to get access to land checks.
519 */
520void 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.

Callers 1

time5SecondsMethod · 0.80

Calls 13

setAltitudeMethod · 0.80
getSpeedPercentageMethod · 0.80
getTrajectoryPointMethod · 0.80
setDetectedMethod · 0.80
getStatusMethod · 0.45
getPointsMethod · 0.45
getTypeMethod · 0.45
getLongitudeMethod · 0.45
getLatitudeMethod · 0.45
setSpeedMethod · 0.45
getMaxSpeedMethod · 0.45
getRulesMethod · 0.45

Tested by

no test coverage detected