OpenXcom
1.0
Open-source clone of the original X-Com
|
Represents an ongoing alien mission. More...
#include <AlienMission.h>
Public Member Functions | |
AlienMission (const RuleAlienMission &rule) | |
Creates a mission of the specified type. | |
~AlienMission () | |
Cleans up the mission info. | |
void | load (const YAML::Node &node, SavedGame &game) |
Loads the mission from YAML. More... | |
YAML::Node | save () const |
Saves the mission to YAML. | |
const std::string & | getType () const |
Gets the mission's type. | |
const std::string & | getRegion () const |
Gets the mission's region. | |
void | setRegion (const std::string ®ion, const Ruleset &rules) |
Sets the mission's region. | |
const std::string & | getRace () const |
Gets the mission's race. | |
void | setRace (const std::string &race) |
Sets the mission's race. | |
size_t | getWaveCountdown () const |
Gets the minutes until next wave spawns. | |
void | setWaveCountdown (size_t minutes) |
Sets the minutes until next wave spawns. More... | |
void | setId (int id) |
Sets the unique ID for this mission. More... | |
int | getId () const |
Gets the unique ID for this mission. More... | |
const AlienBase * | getAlienBase () const |
Gets the alien base for this mission. More... | |
void | setAlienBase (const AlienBase *base) |
Sets the alien base for this mission. More... | |
bool | isOver () const |
Is this mission over? More... | |
void | think (Game &engine, const Globe &globe) |
Handle UFO spawning for the mission. | |
void | start (size_t initialCount=0) |
Initialize with values from rules. | |
void | increaseLiveUfos () |
Increase number of live UFOs. | |
void | decreaseLiveUfos () |
Decrease number of live UFOs. | |
void | ufoReachedWaypoint (Ufo &ufo, Game &engine, const Globe &globe) |
Handle UFO reaching a waypoint. More... | |
void | ufoLifting (Ufo &ufo, Game &engine, const Globe &globe) |
Handle UFO lifting from the ground. More... | |
void | ufoShotDown (Ufo &ufo, Game &engine, const Globe &globe) |
Handle UFO shot down. More... | |
void | addScore (const double lon, const double lat, Game &engine) |
Handle Points for mission successes. More... | |
Represents an ongoing alien mission.
Contains variable info about the mission, like spawn counter, target region and current wave.
void OpenXcom::AlienMission::addScore | ( | const double | lon, |
const double | lat, | ||
Game & | engine | ||
) |
Handle Points for mission successes.
Add alien points to the country and region at the coordinates given.
lon | Longitudinal coordinates to check. |
lat | Latitudinal coordinates to check. |
engine | The game engine, required to get access to game data and game rules. |
const AlienBase * OpenXcom::AlienMission::getAlienBase | ( | ) | const |
Gets the alien base for this mission.
Only alien supply missions ever have a valid pointer.
int OpenXcom::AlienMission::getId | ( | ) | const |
Gets the unique ID for this mission.
bool OpenXcom::AlienMission::isOver | ( | ) | const |
Is this mission over?
Check if a mission is over and can be safely removed from the game.
A mission is over if it will spawn no more UFOs and it has no UFOs still in the game.
void OpenXcom::AlienMission::load | ( | const YAML::Node & | node, |
SavedGame & | game | ||
) |
Loads the mission from YAML.
node | The YAML node containing the data. |
game | The game data, required to locate the alien base. |
void OpenXcom::AlienMission::setAlienBase | ( | const AlienBase * | base | ) |
Sets the alien base for this mission.
Sets the alien base associated with this mission.
Only the alien supply missions care about this.
base | A pointer to an alien base. |
void OpenXcom::AlienMission::setId | ( | int | id | ) |
Sets the unique ID for this mission.
Assigns a unique ID to this mission.
It is an error to assign two IDs to the same mission.
id | The UD to assign. |
void OpenXcom::AlienMission::setWaveCountdown | ( | size_t | minutes | ) |
Sets the minutes until next wave spawns.
The new time must be a multiple of 30 minutes, and more than 0.
Calling this on a finished mission has no effect.
minutes | The minutes until the next UFO wave will spawn. |
Handle UFO lifting from the ground.
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.
ufo | The UFO that reached it's waypoint. |
engine | The game engine, required to get access to game data and game rules. |
globe | The earth globe, required to get access to land checks. |
Handle UFO reaching a waypoint.
This function is called when one of the mission's UFOs arrives at it's current destination.
It takes care of sending the UFO to the next waypoint, landing UFOs 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.
ufo | The UFO that reached it's waypoint. |
engine | The game engine, required to get access to game data and game rules. |
globe | The earth globe, required to get access to land checks. |
Handle UFO shot down.
This function is called when one of the mission's UFOs is shot down (crashed or destroyed).
Currently the only thing that happens is delaying the next UFO in the mission sequence.
ufo | The UFO that was shot down. |
engine | The game engine, unused for now. |
globe | The earth globe, unused for now. |