![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Represents a craft stored in a base. More...
#include <Craft.h>
Public Member Functions | |
| Craft (RuleCraft *rules, Base *base, int id=0) | |
| Creates a craft of the specified type. More... | |
| ~Craft () | |
| Cleans up the craft. More... | |
| void | load (const YAML::Node &node, const Mod *mod, SavedGame *save) |
| Loads the craft from YAML. More... | |
| YAML::Node | save () const |
| Saves the craft to YAML. More... | |
| std::string | getType () const |
| Gets the craft's type. More... | |
| RuleCraft * | getRules () const |
| Gets the craft's ruleset. More... | |
| void | changeRules (RuleCraft *rules) |
| Sets the craft's ruleset. More... | |
| std::string | getDefaultName (Language *lang) const |
| Gets the craft's default name. More... | |
| int | getMarker () const |
| Gets the craft's marker sprite. More... | |
| Base * | getBase () const |
| Gets the craft's base. More... | |
| void | setBase (Base *base, bool move=true) |
| Sets the craft's base. More... | |
| std::string | getStatus () const |
| Gets the craft's status. More... | |
| void | setStatus (const std::string &status) |
| Sets the craft's status. More... | |
| std::string | getAltitude () const |
| Gets the craft's altitude. More... | |
| void | setDestination (Target *dest) |
| Sets the craft's destination. More... | |
| int | getNumWeapons () const |
| Gets the craft's amount of weapons. More... | |
| int | getNumSoldiers () const |
| Gets the craft's amount of soldiers. More... | |
| int | getNumEquipment () const |
| Gets the craft's amount of equipment. More... | |
| int | getNumVehicles () const |
| Gets the craft's amount of vehicles. More... | |
| std::vector< CraftWeapon * > * | getWeapons () |
| Gets the craft's weapons. More... | |
| ItemContainer * | getItems () |
| Gets the craft's items. More... | |
| std::vector< Vehicle * > * | getVehicles () |
| Gets the craft's vehicles. More... | |
| int | getFuel () const |
| Gets the craft's amount of fuel. More... | |
| void | setFuel (int fuel) |
| Sets the craft's amount of fuel. More... | |
| int | getFuelPercentage () const |
| Gets the craft's percentage of fuel. More... | |
| int | getDamage () const |
| Gets the craft's amount of damage. More... | |
| void | setDamage (int damage) |
| Sets the craft's amount of damage. More... | |
| int | getDamagePercentage () const |
| Gets the craft's percentage of damage. More... | |
| bool | getLowFuel () const |
| Gets whether the craft is running out of fuel. More... | |
| void | setLowFuel (bool low) |
| Sets whether the craft is running out of fuel. More... | |
| bool | getMissionComplete () const |
| Gets whether the craft has just finished a mission. More... | |
| void | setMissionComplete (bool mission) |
| Sets whether the craft has just finished a mission. More... | |
| double | getDistanceFromBase () const |
| Gets the craft's distance from its base. More... | |
| int | getFuelConsumption () const |
| Gets the craft's fuel consumption. More... | |
| int | getFuelConsumption (int speed) const |
| Gets the craft's fuel consumption at a certain speed. More... | |
| int | getFuelLimit () const |
| Gets the craft's minimum fuel limit. More... | |
| int | getFuelLimit (Base *base) const |
| Gets the craft's minimum fuel limit to go to a base. More... | |
| double | getBaseRange () const |
| Returns the maximum range the craft can travel from its origin base on its current fuel. More... | |
| void | returnToBase () |
| Returns the craft to its base. More... | |
| bool | detect (Target *target) const |
| Checks if a target is detected by the craft's radar. More... | |
| bool | insideRadarRange (Target *target) const |
| Checks if a target is inside the craft's radar range. More... | |
| void | think () |
| Handles craft logic. More... | |
| void | checkup () |
| Does a craft full checkup. More... | |
| void | consumeFuel () |
| Consumes the craft's fuel. More... | |
| void | repair () |
| Repairs the craft. More... | |
| void | refuel () |
| Refuels the craft. More... | |
| std::string | rearm (const Mod *mod) |
| Rearms the craft. More... | |
| void | setInBattlescape (bool inbattle) |
| Sets the craft's battlescape status. More... | |
| bool | isInBattlescape () const |
| Gets if the craft is in battlescape. More... | |
| bool | isDestroyed () const |
| Gets if craft is destroyed during dogfights. More... | |
| int | getSpaceAvailable () const |
| Gets the amount of space available inside a craft. More... | |
| int | getSpaceUsed () const |
| Gets the amount of space used inside a craft. More... | |
| int | getVehicleCount (const std::string &vehicle) const |
| Gets the craft's vehicles of a certain type. More... | |
| void | setInDogfight (const bool inDogfight) |
| Sets the craft's dogfight status. More... | |
| bool | isInDogfight () const |
| Gets if the craft is in dogfight. More... | |
| void | setInterceptionOrder (const int order) |
| Sets interception order (first craft to leave the base gets 1, second 2, etc.). More... | |
| int | getInterceptionOrder () const |
| Gets interception number. More... | |
| CraftId | getUniqueId () const |
| Gets the craft's unique id. More... | |
| void | unload (const Mod *mod) |
| Unloads the craft. More... | |
| void | reuseItem (const std::string &item) |
| Reuses a base item. More... | |
Public Member Functions inherited from OpenXcom::MovingTarget | |
| virtual | ~MovingTarget () |
| Cleans up the moving target. More... | |
| virtual void | load (const YAML::Node &node) |
| Loads the moving target from 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. | |
Public Member Functions inherited from OpenXcom::Target | |
| 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... | |
| virtual std::string | getMarkerName () const |
| Gets the target's marker 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... | |
Static Public Member Functions | |
| static CraftId | loadId (const YAML::Node &node) |
| Loads a craft ID from YAML. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from OpenXcom::MovingTarget | |
| virtual void | calculateSpeed () |
| Calculates a new speed vector to the destination. More... | |
| MovingTarget () | |
| Creates a moving target. More... | |
Protected Member Functions inherited from OpenXcom::Target | |
| Target () | |
| Creates a target. More... | |
Static Protected Member Functions inherited from OpenXcom::MovingTarget | |
| static double | calculateRadianSpeed (int speed) |
| Converts a speed to radians. More... | |
Represents a craft stored in a base.
Contains variable info about a craft like position, fuel, damage, etc.
Creates a craft of the specified type.
Initializes a craft of the specified type and assigns it the latest craft ID available.
| rules | Pointer to ruleset. |
| base | Pointer to base of origin. |
| id | ID to assign to the craft (0 to not assign). |
| OpenXcom::Craft::~Craft | ( | ) |
Cleans up the craft.
Delete the contents of the craft from memory.
| void OpenXcom::Craft::changeRules | ( | RuleCraft * | rules | ) |
Sets the craft's ruleset.
Changes the ruleset for the craft's type.
| rules | Pointer to ruleset. |
| void OpenXcom::Craft::checkup | ( | ) |
Does a craft full checkup.
Checks the condition of all the craft's systems to define its new status (eg.
when arriving at base).
| void OpenXcom::Craft::consumeFuel | ( | ) |
Consumes the craft's fuel.
Consumes the craft's fuel every 10 minutes while it's on the air.
| bool OpenXcom::Craft::detect | ( | Target * | target | ) | const |
Checks if a target is detected by the craft's radar.
Returns if a certain target is detected by the craft's radar, taking in account the range and chance.
| target | Pointer to target to compare. |
| std::string OpenXcom::Craft::getAltitude | ( | ) | const |
Gets the craft's altitude.
Returns the current altitude of the craft.
| Base * OpenXcom::Craft::getBase | ( | ) | const |
Gets the craft's base.
Returns the base the craft belongs to.
| double OpenXcom::Craft::getBaseRange | ( | ) | const |
Returns the maximum range the craft can travel from its origin base on its current fuel.
| int OpenXcom::Craft::getDamage | ( | ) | const |
Gets the craft's amount of damage.
Returns the amount of damage this craft has taken.
| int OpenXcom::Craft::getDamagePercentage | ( | ) | const |
Gets the craft's percentage of damage.
Returns the ratio between the amount of damage this craft can take and the total it can take before it's destroyed.
|
virtual |
Gets the craft's default name.
Returns the craft's unique default name.
| lang | Language to get strings from. |
Reimplemented from OpenXcom::Target.
| double OpenXcom::Craft::getDistanceFromBase | ( | ) | const |
Gets the craft's distance from its base.
Returns the current distance between the craft and the base it belongs to.
| int OpenXcom::Craft::getFuel | ( | ) | const |
Gets the craft's amount of fuel.
Returns the amount of fuel currently contained in this craft.
| int OpenXcom::Craft::getFuelConsumption | ( | ) | const |
Gets the craft's fuel consumption.
Returns the amount of fuel the craft uses up while it's on the air, based on its current speed.
| int OpenXcom::Craft::getFuelConsumption | ( | int | speed | ) | const |
Gets the craft's fuel consumption at a certain speed.
Returns the amount of fuel the craft uses up while it's on the air.
| speed | Craft speed for estimation. |
| int OpenXcom::Craft::getFuelLimit | ( | ) | const |
Gets the craft's minimum fuel limit.
Returns the minimum required fuel for the craft to make it back to base.
| int OpenXcom::Craft::getFuelLimit | ( | Base * | base | ) | const |
Gets the craft's minimum fuel limit to go to a base.
Returns the minimum required fuel for the craft to go to a base.
| base | Pointer to target base. |
| int OpenXcom::Craft::getFuelPercentage | ( | ) | const |
Gets the craft's percentage of fuel.
Returns the ratio between the amount of fuel currently contained in this craft and the total it can carry.
| int OpenXcom::Craft::getInterceptionOrder | ( | ) | const |
Gets interception number.
Gets interception order.
| ItemContainer * OpenXcom::Craft::getItems | ( | ) |
Gets the craft's items.
Returns the list of items in the craft.
| bool OpenXcom::Craft::getLowFuel | ( | ) | const |
Gets whether the craft is running out of fuel.
Returns whether the craft is currently low on fuel (only has enough to head back to base).
|
virtual |
Gets the craft's marker sprite.
Returns the globe marker for the craft.
Implements OpenXcom::Target.
| bool OpenXcom::Craft::getMissionComplete | ( | ) | const |
Gets whether the craft has just finished a mission.
Returns whether the craft has just done a ground mission, and is forced to return to base.
| int OpenXcom::Craft::getNumEquipment | ( | ) | const |
Gets the craft's amount of equipment.
Returns the amount of equipment currently equipped on this craft.
| int OpenXcom::Craft::getNumSoldiers | ( | ) | const |
Gets the craft's amount of soldiers.
Returns the amount of soldiers from a list that are currently attached to this craft.
| int OpenXcom::Craft::getNumVehicles | ( | ) | const |
Gets the craft's amount of vehicles.
Returns the amount of vehicles currently contained in this craft.
| int OpenXcom::Craft::getNumWeapons | ( | ) | const |
Gets the craft's amount of weapons.
Returns the amount of weapons currently equipped on this craft.
| RuleCraft * OpenXcom::Craft::getRules | ( | ) | const |
Gets the craft's ruleset.
Returns the ruleset for the craft's type.
| int OpenXcom::Craft::getSpaceAvailable | ( | ) | const |
Gets the amount of space available inside a craft.
Returns the amount of space available for soldiers and vehicles.
| int OpenXcom::Craft::getSpaceUsed | ( | ) | const |
Gets the amount of space used inside a craft.
Returns the amount of space in use by soldiers and vehicles.
| std::string OpenXcom::Craft::getStatus | ( | ) | const |
Gets the craft's status.
Returns the current status of the craft.
|
virtual |
Gets the craft's type.
Returns the craft's unique type used for savegame purposes.
Implements OpenXcom::Target.
| CraftId OpenXcom::Craft::getUniqueId | ( | ) | const |
Gets the craft's unique id.
| int OpenXcom::Craft::getVehicleCount | ( | const std::string & | vehicle | ) | const |
Gets the craft's vehicles of a certain type.
Returns the total amount of vehicles of a certain type stored in the craft.
| vehicle | Vehicle type. |
| std::vector< Vehicle * > * OpenXcom::Craft::getVehicles | ( | ) |
Gets the craft's vehicles.
Returns the list of vehicles currently equipped in the craft.
| std::vector< CraftWeapon * > * OpenXcom::Craft::getWeapons | ( | ) |
Gets the craft's weapons.
Returns the list of weapons currently equipped in the craft.
| bool OpenXcom::Craft::insideRadarRange | ( | Target * | target | ) | const |
Checks if a target is inside the craft's radar range.
Returns if a certain target is inside the craft's radar range, taking in account the positions of both.
| target | Pointer to target to compare. |
| bool OpenXcom::Craft::isDestroyed | ( | ) | const |
Gets if craft is destroyed during dogfights.
Returns the craft destroyed status.
If the amount of damage the craft take is more than it's health it will be destroyed.
| bool OpenXcom::Craft::isInBattlescape | ( | ) | const |
Gets if the craft is in battlescape.
Returns the craft's battlescape status.
| bool OpenXcom::Craft::isInDogfight | ( | ) | const |
Gets if the craft is in dogfight.
Returns the craft's dogfight status.
Loads the craft from YAML.
Loads the craft from a YAML file.
| node | YAML node. |
| mod | Mod for the saved game. |
| save | Pointer to the saved game. |
|
static |
Loads a craft ID from YAML.
Loads a craft unique identifier from a YAML file.
| node | YAML node. |
| std::string OpenXcom::Craft::rearm | ( | const Mod * | mod | ) |
Rearms the craft.
Rearms the craft's weapons by adding ammo every hour while it's docked in the base.
| mod | Pointer to mod. |
| void OpenXcom::Craft::refuel | ( | ) |
Refuels the craft.
Refuels the craft every 30 minutes while it's docked in the base.
| void OpenXcom::Craft::repair | ( | ) |
Repairs the craft.
Repairs the craft's damage every hour while it's docked in the base.
| void OpenXcom::Craft::returnToBase | ( | ) |
Returns the craft to its base.
Sends the craft back to its origin base.
| void OpenXcom::Craft::reuseItem | ( | const std::string & | item | ) |
Reuses a base item.
Checks if an item can be reused by the craft and updates its status appropriately.
| item | Item ID. |
|
virtual |
Saves the craft to YAML.
Saves the craft to a YAML file.
Reimplemented from OpenXcom::MovingTarget.
| void OpenXcom::Craft::setBase | ( | Base * | base, |
| bool | move = true |
||
| ) |
Sets the craft's base.
Changes the base the craft belongs to.
| base | Pointer to base. |
| move | Move the craft to the base coordinates. |
| void OpenXcom::Craft::setDamage | ( | int | damage | ) |
Sets the craft's amount of damage.
Changes the amount of damage this craft has taken.
| damage | Amount of damage. |
|
virtual |
Sets the craft's destination.
Changes the destination the craft is heading to.
| dest | Pointer to new destination. |
Reimplemented from OpenXcom::MovingTarget.
| void OpenXcom::Craft::setFuel | ( | int | fuel | ) |
Sets the craft's amount of fuel.
Changes the amount of fuel currently contained in this craft.
| fuel | Amount of fuel. |
| void OpenXcom::Craft::setInBattlescape | ( | bool | inbattle | ) |
Sets the craft's battlescape status.
Changes the craft's battlescape status.
| inbattle | True if it's in battle, False otherwise. |
| void OpenXcom::Craft::setInDogfight | ( | const bool | inDogfight | ) |
Sets the craft's dogfight status.
Changes the craft's dogfight status.
| inDogfight | True if it's in dogfight, False otherwise. |
| void OpenXcom::Craft::setInterceptionOrder | ( | const int | order | ) |
Sets interception order (first craft to leave the base gets 1, second 2, etc.).
| order | Interception order. |
| void OpenXcom::Craft::setLowFuel | ( | bool | low | ) |
Sets whether the craft is running out of fuel.
Changes whether the craft is currently low on fuel (only has enough to head back to base).
| low | True if it's low, false otherwise. |
| void OpenXcom::Craft::setMissionComplete | ( | bool | mission | ) |
Sets whether the craft has just finished a mission.
Changes whether the craft has just done a ground mission, and is forced to return to base.
| mission | True if it's returning, false otherwise. |
| void OpenXcom::Craft::setStatus | ( | const std::string & | status | ) |
Sets the craft's status.
Changes the current status of the craft.
| status | Status string. |
| void OpenXcom::Craft::think | ( | ) |
Handles craft logic.
Moves the craft to its destination.
| void OpenXcom::Craft::unload | ( | const Mod * | mod | ) |
Unloads the craft.
Unloads all the craft contents to the base.
| mod | Pointer to mod. |
1.8.14