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 Ruleset *rule, SavedGame *save) |
Loads the craft from YAML. More... | |
YAML::Node | save () const |
Saves the craft to YAML. More... | |
YAML::Node | saveId () const |
Saves the craft's ID to YAML. More... | |
RuleCraft * | getRules () const |
Gets the craft's ruleset. More... | |
void | setRules (RuleCraft *rules) |
Sets the craft's ruleset. More... | |
int | getId () const |
Gets the craft's ID. More... | |
std::wstring | getName (Language *lang) const |
Gets the craft's name. More... | |
void | setName (const std::wstring &newName) |
Sets the craft's name. More... | |
Base * | getBase () const |
Gets the craft's base. More... | |
void | setBase (Base *base) |
Sets the craft's base. More... | |
void | setBaseOnly (Base *base) |
Sets the craft's base. (without setting the craft's coordinates) 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... | |
double | getDistanceFromBase () const |
Gets the craft's distance from its base. More... | |
int | getFuelConsumption () const |
Gets the craft's fuel consumption. 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... | |
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... | |
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 (Ruleset *rules) |
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... | |
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... | |
Target * | getDestination () 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 | |
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... | |
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::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.
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.
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 speed.
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::getId | ( | ) | const |
Gets the craft's ID.
Returns the craft's unique ID.
Each craft can be identified by its type and ID.
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 name.
Returns the craft's unique identifying name.
If there's no custom name, the language default is used.
lang | Language to get strings from. |
Implements OpenXcom::Target.
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.
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::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. |
rule | Ruleset for the saved game. |
save | Pointer to the saved game. |
std::string OpenXcom::Craft::rearm | ( | Ruleset * | rules | ) |
Rearms the craft.
Rearms the craft's weapons by adding ammo every hour while it's docked in the base.
rules | Pointer to ruleset. |
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.
|
virtual |
Saves the craft to YAML.
Saves the craft to a YAML file.
Reimplemented from OpenXcom::MovingTarget.
|
virtual |
Saves the craft's ID to YAML.
Saves the craft's unique identifiers to a YAML file.
Reimplemented from OpenXcom::Target.
void OpenXcom::Craft::setBase | ( | Base * | base | ) |
Sets the craft's base.
Changes the base the craft belongs to.
base | Pointer to base. |
void OpenXcom::Craft::setBaseOnly | ( | Base * | base | ) |
Sets the craft's base. (without setting the craft's coordinates)
Changes the base the craft belongs to.
(without setting the craft's coordinates)
base | Pointer to base. |
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::setName | ( | const std::wstring & | newName | ) |
Sets the craft's name.
Changes the craft's custom name.
newName | New custom name. If set to blank, the language default is used. |
void OpenXcom::Craft::setRules | ( | RuleCraft * | rules | ) |
Sets the craft's ruleset.
Changes the ruleset for the craft's type.
rules | Pointer to ruleset. |
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.