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::Ufo Class Reference

Represents an alien UFO on the map. More...

#include <Ufo.h>

Inheritance diagram for OpenXcom::Ufo:
OpenXcom::MovingTarget OpenXcom::Target

Public Member Functions

 Ufo (RuleUfo *rules)
 Creates a UFO of the specified type. More...
 
 ~Ufo ()
 Cleans up the UFO. More...
 
void load (const YAML::Node &node, const Ruleset &ruleset, SavedGame &game)
 Loads the UFO from YAML. More...
 
YAML::Node save (bool newBattle) const
 Saves the UFO to YAML. More...
 
YAML::Node saveId () const
 Saves the UFO's ID to YAML. More...
 
RuleUfogetRules () const
 Gets the UFO's ruleset. More...
 
int getId () const
 Gets the UFO's ID. More...
 
void setId (int id)
 Sets the UFO's ID. More...
 
std::wstring getName (Language *lang) const
 Gets the UFO's name. More...
 
int getDamage () const
 Gets the UFO's amount of damage. More...
 
void setDamage (int damage)
 Sets the UFO's amount of damage. More...
 
bool getDetected () const
 Gets the UFO's detection status. More...
 
void setDetected (bool detected)
 Sets the UFO's detection status. More...
 
size_t getSecondsRemaining () const
 Gets the UFO's seconds left on the ground. More...
 
void setSecondsRemaining (size_t seconds)
 Sets the UFO's seconds left on the ground. More...
 
std::string getDirection () const
 Gets the UFO's direction. More...
 
std::string getAltitude () const
 Gets the UFO's altitude. More...
 
void setAltitude (const std::string &altitude)
 Sets the UFO's altitude. More...
 
enum UfoStatus getStatus () const
 Gets the UFO status.
 
void setStatus (enum UfoStatus status)
 Set the UFO's status.
 
bool isCrashed () const
 Gets if the UFO has crashed. More...
 
bool isDestroyed () const
 Gets if the UFO has been destroyed. More...
 
void think ()
 Handles UFO logic. More...
 
void setInBattlescape (bool inbattle)
 Sets the UFO's battlescape status. More...
 
bool isInBattlescape () const
 Gets if the UFO is in battlescape. More...
 
const std::string & getAlienRace () const
 Gets the UFO's alien race. More...
 
void setShotDownByCraftId (const int id)
 Sets the ID of craft which shot down the UFO.
 
int getShotDownByCraftId () const
 Gets the ID of craft which shot down the UFO.
 
int getVisibility () const
 Gets the UFO's visibility. More...
 
const std::string & getMissionType () const
 Gets the UFO's Mission type. More...
 
void setMissionInfo (AlienMission *mission, const UfoTrajectory *trajectory)
 Sets the UFO's mission information. More...
 
bool getHyperDetected () const
 Gets the UFO's hyper detection status. More...
 
void setHyperDetected (bool hyperdetected)
 Sets the UFO's hyper detection status. More...
 
size_t getTrajectoryPoint () const
 Gets the UFO's progress on the trajectory track.
 
void setTrajectoryPoint (size_t np)
 Sets the UFO's progress on the trajectory track.
 
const UfoTrajectorygetTrajectory () const
 Gets the UFO's trajectory.
 
AlienMissiongetMission () const
 Gets the UFO's mission object.
 
void setDestination (Target *dest)
 Sets the UFO's destination. More...
 
int getShootingAt () const
 Get which interceptor this ufo is engaging.
 
void setShootingAt (int target)
 Set which interceptor this ufo is engaging.
 
int getLandId () const
 Gets the UFO's landing site ID.
 
void setLandId (int id)
 Sets the UFO's landing site ID.
 
int getCrashId () const
 Gets the UFO's crash site ID.
 
void setCrashId (int id)
 Sets the UFO's crash site ID.
 
void setHitFrame (int frame)
 Sets the UFO's hit frame.
 
int getHitFrame ()
 Gets the UFO's hit frame.
 
- Public Member Functions inherited from OpenXcom::MovingTarget
virtual ~MovingTarget ()
 Cleans up the moving target. More...
 
void load (const YAML::Node &node)
 Loads the moving target from YAML. More...
 
virtual YAML::Node save () const
 Saves the moving target to YAML. More...
 
TargetgetDestination () const
 Gets the moving target's destination. More...
 
int getSpeed () const
 Gets the moving target's speed. More...
 
void setSpeed (int speed)
 Sets the moving target's speed. More...
 
bool reachedDestination () const
 Has the moving target reached its destination? More...
 
void move ()
 Move towards the destination. More...
 
- Public Member Functions inherited from OpenXcom::Target
virtual ~Target ()
 Cleans up the target. More...
 
void load (const YAML::Node &node)
 Loads the moving target from YAML. More...
 
double getLongitude () const
 Gets the target's longitude. More...
 
void setLongitude (double lon)
 Sets the target's longitude. More...
 
double getLatitude () const
 Gets the target's latitude. More...
 
void setLatitude (double lat)
 Sets the target's latitude. More...
 
std::vector< Target * > * getFollowers ()
 Gets the target's followers. More...
 
double getDistance (const Target *target) const
 Gets the distance to another target. More...
 

Additional Inherited Members

- Protected Member Functions inherited from OpenXcom::MovingTarget
 MovingTarget ()
 Creates a moving target. More...
 
- Protected Member Functions inherited from OpenXcom::Target
 Target ()
 Creates a target. More...
 

Detailed Description

Represents an alien UFO on the map.

Contains variable info about a UFO like position, damage, speed, etc.

See also
RuleUfo

Constructor & Destructor Documentation

OpenXcom::Ufo::Ufo ( RuleUfo rules)

Creates a UFO of the specified type.

Initializes a UFO of the specified type.

Parameters
rulesPointer to ruleset.
OpenXcom::Ufo::~Ufo ( )

Cleans up the UFO.

Make sure our mission forget's us, and we only delete targets we own (waypoints).

Member Function Documentation

const std::string & OpenXcom::Ufo::getAlienRace ( ) const

Gets the UFO's alien race.

Returns the alien race currently residing in the UFO.

Returns
Alien race.
std::string OpenXcom::Ufo::getAltitude ( ) const

Gets the UFO's altitude.

Returns the current altitude of the UFO.

Returns
Altitude.
int OpenXcom::Ufo::getDamage ( ) const

Gets the UFO's amount of damage.

Returns the amount of damage this UFO has taken.

Returns
Amount of damage.
bool OpenXcom::Ufo::getDetected ( ) const

Gets the UFO's detection status.

Returns whether this UFO has been detected by radars.

Returns
Detection status.
std::string OpenXcom::Ufo::getDirection ( ) const

Gets the UFO's direction.

Returns the current direction the UFO is heading in.

Returns
Direction.
bool OpenXcom::Ufo::getHyperDetected ( ) const

Gets the UFO's hyper detection status.

Returns whether this UFO has been detected by hyper-wave.

Returns
Detection status.
int OpenXcom::Ufo::getId ( ) const

Gets the UFO's ID.

Returns the UFO's unique ID.

If it's 0, this UFO has never been detected.

Returns
Unique ID.
const std::string & OpenXcom::Ufo::getMissionType ( ) const

Gets the UFO's Mission type.

Returns the Mission type of the UFO.

Returns
Mission.
std::wstring OpenXcom::Ufo::getName ( Language lang) const
virtual

Gets the UFO's name.

Returns the UFO's unique identifying name.

Parameters
langLanguage to get strings from.
Returns
Full name.

Implements OpenXcom::Target.

RuleUfo * OpenXcom::Ufo::getRules ( ) const

Gets the UFO's ruleset.

Returns the ruleset for the UFO's type.

Returns
Pointer to ruleset.
size_t OpenXcom::Ufo::getSecondsRemaining ( ) const

Gets the UFO's seconds left on the ground.

Returns the amount of remaining seconds the UFO has left on the ground.

After this many seconds thet UFO will take off, if landed, or disappear, if crashed.

Returns
Amount of seconds.
int OpenXcom::Ufo::getVisibility ( ) const

Gets the UFO's visibility.

Returns a UFO's visibility to radar detection.

The UFO's size and altitude affect the chances of it being detected by radars.

Returns
Visibility modifier.
bool OpenXcom::Ufo::isCrashed ( ) const

Gets if the UFO has crashed.

Returns if this UFO took enough damage to cause it to crash.

Returns
Crashed status.
bool OpenXcom::Ufo::isDestroyed ( ) const

Gets if the UFO has been destroyed.

Returns if this UFO took enough damage to cause it to crash.

Returns
Crashed status.
bool OpenXcom::Ufo::isInBattlescape ( ) const

Gets if the UFO is in battlescape.

Gets the UFO's battlescape status.

Returns
bool
void OpenXcom::Ufo::load ( const YAML::Node &  node,
const Ruleset ruleset,
SavedGame game 
)

Loads the UFO from YAML.

Loads the UFO from a YAML file.

Parameters
nodeYAML node.
rulesetThe game rules. Use to access the trajectory rules.
gameThe game data. Used to find the UFO's mission.
YAML::Node OpenXcom::Ufo::save ( bool  newBattle) const

Saves the UFO to YAML.

Saves the UFO to a YAML file.

Returns
YAML node.
YAML::Node OpenXcom::Ufo::saveId ( ) const
virtual

Saves the UFO's ID to YAML.

Saves the UFO's unique identifiers to a YAML file.

Returns
YAML node.

Reimplemented from OpenXcom::Target.

void OpenXcom::Ufo::setAltitude ( const std::string &  altitude)

Sets the UFO's altitude.

Changes the current altitude of the UFO.

Parameters
altitudeAltitude.
void OpenXcom::Ufo::setDamage ( int  damage)

Sets the UFO's amount of damage.

Changes the amount of damage this UFO has taken.

Parameters
damageAmount of damage.
void OpenXcom::Ufo::setDestination ( Target dest)
virtual

Sets the UFO's destination.

Handle destination changes, making sure to delete old waypoint destinations.

Parameters
destPointer to the new destination.

Reimplemented from OpenXcom::MovingTarget.

void OpenXcom::Ufo::setDetected ( bool  detected)

Sets the UFO's detection status.

Changes whether this UFO has been detected by radars.

Parameters
detectedDetection status.
void OpenXcom::Ufo::setHyperDetected ( bool  hyperdetected)

Sets the UFO's hyper detection status.

Changes whether this UFO has been detected by hyper-wave.

Parameters
hyperdetectedDetection status.
void OpenXcom::Ufo::setId ( int  id)

Sets the UFO's ID.

Changes the UFO's unique ID.

Parameters
idUnique ID.
void OpenXcom::Ufo::setInBattlescape ( bool  inbattle)

Sets the UFO's battlescape status.

Parameters
inbattle.
void OpenXcom::Ufo::setMissionInfo ( AlienMission mission,
const UfoTrajectory trajectory 
)

Sets the UFO's mission information.

Sets the mission information of the UFO.

The UFO will start at the first point of the trajectory. The actual UFO information is not changed here, this only sets the information kept on behalf of the mission.

Parameters
missionPointer to the actual mission object.
trajectoryPointer to the actual mission trajectory.
void OpenXcom::Ufo::setSecondsRemaining ( size_t  seconds)

Sets the UFO's seconds left on the ground.

Changes the amount of remaining seconds the UFO has left on the ground.

After this many seconds thet UFO will take off, if landed, or disappear, if crashed.

Parameters
secondsAmount of seconds.
void OpenXcom::Ufo::think ( )

Handles UFO logic.

Moves the UFO to its destination.


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