![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Represents an alien UFO on the map. More...
#include <Ufo.h>
Public Member Functions | |
Ufo (const RuleUfo *rules) | |
Creates a UFO of the specified type. More... | |
~Ufo () | |
Cleans up the UFO. More... | |
void | load (const YAML::Node &node, const Mod &ruleset, SavedGame &game) |
Loads the UFO from YAML. More... | |
YAML::Node | save (bool newBattle) const |
Saves the UFO to YAML. More... | |
std::string | getType () const |
Gets the UFO's type. More... | |
const RuleUfo * | getRules () const |
Gets the UFO's ruleset. More... | |
void | changeRules (const RuleUfo *rules) |
Sets the UFO's ruleset. More... | |
std::string | getDefaultName (Language *lang) const |
Gets the UFO's default name. More... | |
std::string | getMarkerName () const |
Gets the UFO's marker name. More... | |
int | getMarker () const |
Gets the UFO's marker sprite. 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... | |
int | getAltitudeInt () 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 CraftId &craftId) |
Sets the ID of craft which shot down the UFO. | |
CraftId | 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 UfoTrajectory & | getTrajectory () const |
Gets the UFO's trajectory. | |
AlienMission * | getMission () 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. More... | |
void | setShootingAt (int target) |
Set which interceptor this ufo is engaging. More... | |
int | getLandId () const |
Gets the UFO's landing site ID. More... | |
void | setLandId (int id) |
Sets the UFO's landing site ID. More... | |
int | getCrashId () const |
Gets the UFO's crash site ID. More... | |
void | setCrashId (int id) |
Sets the UFO's crash site ID. More... | |
void | setHitFrame (int frame) |
Sets the UFO's hit frame. More... | |
int | getHitFrame () const |
Gets the UFO's hit frame. More... | |
void | setFireCountdown (int time) |
Sets the number of ticks until the ufo fires its weapon. More... | |
int | getFireCountdown () const |
Gets the number of ticks until the ufo is ready to fire. More... | |
void | setEscapeCountdown (int time) |
Sets the countdown timer for escaping a dogfight. More... | |
int | getEscapeCountdown () const |
Gets the escape timer for dogfights. More... | |
void | setInterceptionProcessed (bool processed) |
Sets a flag denoting that this ufo has had its timers decremented. More... | |
bool | getInterceptionProcessed () const |
Gets if the ufo has had its timers decremented on this cycle of interception updates. More... | |
![]() | |
virtual | ~MovingTarget () |
Cleans up the moving target. More... | |
virtual 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... | |
Target * | getDestination () const |
Gets the moving target's destination. More... | |
int | getSpeed () const |
Gets the moving target's speed. More... | |
double | getSpeedRadian () const |
Gets the moving target's radial 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... | |
void | calculateMeetPoint () |
Calculate meeting point with the target. | |
double | getMeetLatitude () const |
Returns the latitude of the meeting point. More... | |
double | getMeetLongitude () const |
Returns the longitude of the meeting point. More... | |
void | resetMeetPoint () |
Reset meeting point calculation. More... | |
bool | isMeetCalculated () const |
Returns if the meeting point was calculated. | |
![]() | |
virtual | ~Target () |
Cleans up the target. More... | |
YAML::Node | saveId () const |
Saves the target's ID to 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... | |
int | getId () const |
Gets the target's ID. More... | |
void | setId (int id) |
Sets the target's ID. More... | |
virtual std::string | getName (Language *lang) const |
Gets the target's name. More... | |
void | setName (const std::string &newName) |
Sets the target's name. More... | |
std::vector< MovingTarget * > * | getFollowers () |
Gets the target's followers. More... | |
std::vector< Craft * > | getCraftFollowers () const |
Gets the target's craft followers. More... | |
double | getDistance (const Target *target) const |
Gets the distance to another target. More... | |
Additional Inherited Members | |
![]() | |
MovingTarget () | |
Creates a moving target. More... | |
![]() | |
Target () | |
Creates a target. More... | |
![]() | |
static double | calculateRadianSpeed (int speed) |
Converts a speed to radians. More... | |
Represents an alien UFO on the map.
Contains variable info about a UFO like position, damage, speed, etc.
OpenXcom::Ufo::Ufo | ( | const RuleUfo * | rules | ) |
Creates a UFO of the specified type.
Initializes a UFO of the specified type.
rules | Pointer to ruleset. |
OpenXcom::Ufo::~Ufo | ( | ) |
Cleans up the UFO.
Make sure our mission forget's us, and we only delete targets we own (waypoints).
void OpenXcom::Ufo::changeRules | ( | const RuleUfo * | rules | ) |
Sets the UFO's ruleset.
Changes the ruleset for the UFO's type.
rules | Pointer to ruleset. |
const std::string & OpenXcom::Ufo::getAlienRace | ( | ) | const |
Gets the UFO's alien race.
Returns the alien race currently residing in the UFO.
std::string OpenXcom::Ufo::getAltitude | ( | ) | const |
Gets the UFO's altitude.
Returns the current altitude of the UFO.
int OpenXcom::Ufo::getAltitudeInt | ( | ) | const |
Gets the UFO's altitude.
Returns the current altitude of the UFO.
int OpenXcom::Ufo::getCrashId | ( | ) | const |
Gets the UFO's crash site ID.
int OpenXcom::Ufo::getDamage | ( | ) | const |
Gets the UFO's amount of damage.
Returns the amount of damage this UFO has taken.
|
virtual |
Gets the UFO's default name.
Returns the UFO's unique default name.
lang | Language to get strings from. |
Reimplemented from OpenXcom::Target.
bool OpenXcom::Ufo::getDetected | ( | ) | const |
Gets the UFO's detection status.
Returns whether this UFO has been detected by radars.
std::string OpenXcom::Ufo::getDirection | ( | ) | const |
Gets the UFO's direction.
Returns the current direction the UFO is heading in.
int OpenXcom::Ufo::getEscapeCountdown | ( | ) | const |
Gets the escape timer for dogfights.
int OpenXcom::Ufo::getFireCountdown | ( | ) | const |
Gets the number of ticks until the ufo is ready to fire.
int OpenXcom::Ufo::getHitFrame | ( | ) | const |
Gets the UFO's hit frame.
bool OpenXcom::Ufo::getHyperDetected | ( | ) | const |
Gets the UFO's hyper detection status.
Returns whether this UFO has been detected by hyper-wave.
bool OpenXcom::Ufo::getInterceptionProcessed | ( | ) | const |
Gets if the ufo has had its timers decremented on this cycle of interception updates.
int OpenXcom::Ufo::getLandId | ( | ) | const |
Gets the UFO's landing site ID.
|
virtual |
Gets the UFO's marker sprite.
Returns the globe marker for the UFO.
Implements OpenXcom::Target.
|
virtual |
Gets the UFO's marker name.
Returns the name on the globe for the UFO.
Reimplemented from OpenXcom::Target.
const std::string & OpenXcom::Ufo::getMissionType | ( | ) | const |
Gets the UFO's Mission type.
Returns the Mission type of the UFO.
const RuleUfo * OpenXcom::Ufo::getRules | ( | ) | const |
Gets the UFO's ruleset.
Returns the ruleset for the UFO's type.
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.
int OpenXcom::Ufo::getShootingAt | ( | ) | const |
Get which interceptor this ufo is engaging.
Gets which interception window the UFO is active in.
|
virtual |
Gets the UFO's type.
Returns the UFO's unique type used for savegame purposes.
Implements OpenXcom::Target.
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.
bool OpenXcom::Ufo::isCrashed | ( | ) | const |
Gets if the UFO has crashed.
Returns if this UFO took enough damage to cause it to crash.
bool OpenXcom::Ufo::isDestroyed | ( | ) | const |
Gets if the UFO has been destroyed.
Returns if this UFO took enough damage to cause it to crash.
bool OpenXcom::Ufo::isInBattlescape | ( | ) | const |
Gets if the UFO is in battlescape.
Gets the UFO's battlescape status.
Loads the UFO from YAML.
Loads the UFO from a YAML file.
node | YAML node. |
mod | The game mod. Use to access the trajectory rules. |
game | The 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.
void OpenXcom::Ufo::setAltitude | ( | const std::string & | altitude | ) |
Sets the UFO's altitude.
Changes the current altitude of the UFO.
altitude | Altitude. |
void OpenXcom::Ufo::setCrashId | ( | int | id | ) |
Sets the UFO's crash site ID.
id | the UFO's crash site ID. |
void OpenXcom::Ufo::setDamage | ( | int | damage | ) |
Sets the UFO's amount of damage.
Changes the amount of damage this UFO has taken.
damage | Amount of damage. |
|
virtual |
Sets the UFO's destination.
Handle destination changes, making sure to delete old waypoint destinations.
dest | Pointer 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.
detected | Detection status. |
void OpenXcom::Ufo::setEscapeCountdown | ( | int | time | ) |
Sets the countdown timer for escaping a dogfight.
time | how many ticks until the ship attempts to escape. |
void OpenXcom::Ufo::setFireCountdown | ( | int | time | ) |
Sets the number of ticks until the ufo fires its weapon.
time | number of ticks until refire. |
void OpenXcom::Ufo::setHitFrame | ( | int | frame | ) |
Sets the UFO's hit frame.
frame | the hit frame. |
void OpenXcom::Ufo::setHyperDetected | ( | bool | hyperdetected | ) |
Sets the UFO's hyper detection status.
Changes whether this UFO has been detected by hyper-wave.
hyperdetected | Detection status. |
void OpenXcom::Ufo::setInBattlescape | ( | bool | inbattle | ) |
Sets the UFO's battlescape status.
inbattle | True if it's in battle, False otherwise. |
void OpenXcom::Ufo::setInterceptionProcessed | ( | bool | processed | ) |
Sets a flag denoting that this ufo has had its timers decremented.
prevents multiple interceptions from decrementing or resetting an already running timer. this flag is reset in advance each time the geoscape processes the dogfights.
processed | whether or not we've had our timers processed. |
void OpenXcom::Ufo::setLandId | ( | int | id | ) |
Sets the UFO's landing site ID.
id | landing site ID. |
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.
mission | Pointer to the actual mission object. |
trajectory | Pointer 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.
seconds | Amount of seconds. |
void OpenXcom::Ufo::setShootingAt | ( | int | target | ) |
Set which interceptor this ufo is engaging.
Sets which interception window the UFO is active in.
target | the window the UFO is active in. |
void OpenXcom::Ufo::think | ( | ) |
Handles UFO logic.
Moves the UFO to its destination.