OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
OpenXcom::AlienMission Class Reference

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 &region, 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 AlienBasegetAlienBase () 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...
 

Detailed Description

Represents an ongoing alien mission.

Contains variable info about the mission, like spawn counter, target region and current wave.

See also
RuleAlienMission

Member Function Documentation

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.

Parameters
lonLongitudinal coordinates to check.
latLatitudinal coordinates to check.
engineThe 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.

Returns
A pointer (possibly 0) of the AlienBase for this mission.
int OpenXcom::AlienMission::getId ( ) const

Gets the unique ID for this mission.

Returns
The unique ID assigned to 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.

Returns
If the mission can be safely removed from game.
void OpenXcom::AlienMission::load ( const YAML::Node &  node,
SavedGame game 
)

Loads the mission from YAML.

Parameters
nodeThe YAML node containing the data.
gameThe 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.

Parameters
baseA 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.

Parameters
idThe 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.

Parameters
minutesThe minutes until the next UFO wave will spawn.
void OpenXcom::AlienMission::ufoLifting ( Ufo ufo,
Game engine,
const Globe globe 
)

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.

Parameters
ufoThe UFO that reached it's waypoint.
engineThe game engine, required to get access to game data and game rules.
globeThe earth globe, required to get access to land checks.
void OpenXcom::AlienMission::ufoReachedWaypoint ( Ufo ufo,
Game engine,
const Globe globe 
)

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.

Parameters
ufoThe UFO that reached it's waypoint.
engineThe game engine, required to get access to game data and game rules.
globeThe earth globe, required to get access to land checks.
void OpenXcom::AlienMission::ufoShotDown ( Ufo ufo,
Game engine,
const Globe globe 
)

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.

Parameters
ufoThe UFO that was shot down.
engineThe game engine, unused for now.
globeThe earth globe, unused for now.

The documentation for this class was generated from the following files: