20 #include "MovingTarget.h" 28 typedef std::pair<std::string, int> CraftId;
50 int _fuel, _damage, _interceptionOrder, _takeoff;
51 std::vector<CraftWeapon*> _weapons;
53 std::vector<Vehicle*> _vehicles;
55 bool _lowFuel, _mission, _inBattlescape, _inDogfight;
56 double _speedMaxRadian;
67 YAML::Node
save()
const;
69 static CraftId
loadId(
const YAML::Node &node);
87 void setStatus(
const std::string &status);
std::vector< CraftWeapon * > * getWeapons()
Gets the craft's weapons.
Definition: Craft.cpp:469
Represents a craft stored in a base.
Definition: Craft.h:45
int getDamagePercentage() const
Gets the craft's percentage of damage.
Definition: Craft.cpp:559
int getFuelLimit() const
Gets the craft's minimum fuel limit.
Definition: Craft.cpp:642
int getNumEquipment() const
Gets the craft's amount of equipment.
Definition: Craft.cpp:449
bool detect(Target *target) const
Checks if a target is detected by the craft's radar.
Definition: Craft.cpp:743
YAML::Node save() const
Saves the craft to YAML.
Definition: Craft.cpp:216
std::vector< Vehicle * > * getVehicles()
Gets the craft's vehicles.
Definition: Craft.cpp:488
void setInDogfight(const bool inDogfight)
Sets the craft's dogfight status.
Definition: Craft.cpp:948
void setInBattlescape(bool inbattle)
Sets the craft's battlescape status.
Definition: Craft.cpp:872
int getSpaceAvailable() const
Gets the amount of space available inside a craft.
Definition: Craft.cpp:896
ItemContainer * getItems()
Gets the craft's items.
Definition: Craft.cpp:478
void reuseItem(const std::string &item)
Reuses a base item.
Definition: Craft.cpp:1032
The game data that gets written to disk when the game is saved.
Definition: SavedGame.h:99
Contains all the game-specific static data that never changes throughout the game, like rulesets and resources.
Definition: Mod.h:87
bool isInBattlescape() const
Gets if the craft is in battlescape.
Definition: Craft.cpp:863
void refuel()
Refuels the craft.
Definition: Craft.cpp:795
Craft(RuleCraft *rules, Base *base, int id=0)
Creates a craft of the specified type.
Definition: Craft.cpp:50
int getFuel() const
Gets the craft's amount of fuel.
Definition: Craft.cpp:498
virtual void load(const YAML::Node &node)
Loads the moving target from YAML.
Definition: MovingTarget.cpp:46
int getNumSoldiers() const
Gets the craft's amount of soldiers.
Definition: Craft.cpp:428
void consumeFuel()
Consumes the craft's fuel.
Definition: Craft.cpp:773
~Craft()
Cleans up the craft.
Definition: Craft.cpp:71
int getMarker() const
Gets the craft's marker sprite.
Definition: Craft.cpp:312
std::string getStatus() const
Gets the craft's status.
Definition: Craft.cpp:349
int getNumWeapons() const
Gets the craft's amount of weapons.
Definition: Craft.cpp:403
double getDistanceFromBase() const
Gets the craft's distance from its base.
Definition: Craft.cpp:609
Base * getBase() const
Gets the craft's base.
Definition: Craft.cpp:325
Contains strings used throughout the game for localization.
Definition: Language.h:39
static CraftId loadId(const YAML::Node &node)
Loads a craft ID from YAML.
Definition: Craft.cpp:259
int getDamage() const
Gets the craft's amount of damage.
Definition: Craft.cpp:535
double getBaseRange() const
Returns the maximum range the craft can travel from its origin base on its current fuel...
Definition: Craft.cpp:663
int getSpaceUsed() const
Gets the amount of space used inside a craft.
Definition: Craft.cpp:906
void setFuel(int fuel)
Sets the craft's amount of fuel.
Definition: Craft.cpp:508
void setStatus(const std::string &status)
Sets the craft's status.
Definition: Craft.cpp:358
void repair()
Repairs the craft.
Definition: Craft.cpp:782
std::string getAltitude() const
Gets the craft's altitude.
Definition: Craft.cpp:367
Represents the items contained by a certain entity, like base stores, craft equipment, etc.
Definition: ItemContainer.h:34
void load(const YAML::Node &node, const Mod *mod, SavedGame *save)
Loads the craft from YAML.
Definition: Craft.cpp:90
bool getLowFuel() const
Gets whether the craft is running out of fuel.
Definition: Craft.cpp:569
void setBase(Base *base, bool move=true)
Sets the craft's base.
Definition: Craft.cpp:335
int getInterceptionOrder() const
Gets interception number.
Definition: Craft.cpp:966
Represents a player base on the globe.
Definition: Base.h:45
Represents a specific type of craft.
Definition: RuleCraft.h:36
void setDestination(Target *dest)
Sets the craft's destination.
Definition: Craft.cpp:385
void setDamage(int damage)
Sets the craft's amount of damage.
Definition: Craft.cpp:544
std::string rearm(const Mod *mod)
Rearms the craft.
Definition: Craft.cpp:818
void returnToBase()
Returns the craft to its base.
Definition: Craft.cpp:671
bool isInDogfight() const
Gets if the craft is in dogfight.
Definition: Craft.cpp:939
bool insideRadarRange(Target *target) const
Checks if a target is inside the craft's radar range.
Definition: Craft.cpp:763
bool isDestroyed() const
Gets if craft is destroyed during dogfights.
Definition: Craft.cpp:886
void unload(const Mod *mod)
Unloads the craft.
Definition: Craft.cpp:984
CraftId getUniqueId() const
Gets the craft's unique id.
Definition: Craft.cpp:975
void think()
Handles craft logic.
Definition: Craft.cpp:679
std::string getDefaultName(Language *lang) const
Gets the craft's default name.
Definition: Craft.cpp:303
Base class for moving targets on the globe with a certain speed and destination.
Definition: MovingTarget.h:29
void setLowFuel(bool low)
Sets whether the craft is running out of fuel.
Definition: Craft.cpp:579
void checkup()
Does a craft full checkup.
Definition: Craft.cpp:705
int getFuelConsumption() const
Gets the craft's fuel consumption.
Definition: Craft.cpp:619
int getVehicleCount(const std::string &vehicle) const
Gets the craft's vehicles of a certain type.
Definition: Craft.cpp:922
std::string getType() const
Gets the craft's type.
Definition: Craft.cpp:269
void setMissionComplete(bool mission)
Sets whether the craft has just finished a mission.
Definition: Craft.cpp:599
void move()
Move towards the destination.
Definition: MovingTarget.cpp:205
RuleCraft * getRules() const
Gets the craft's ruleset.
Definition: Craft.cpp:278
Base class for targets on the globe with a set of radian coordinates.
Definition: Target.h:35
int getNumVehicles() const
Gets the craft's amount of vehicles.
Definition: Craft.cpp:459
Definition: BaseInfoState.cpp:40
void setInterceptionOrder(const int order)
Sets interception order (first craft to leave the base gets 1, second 2, etc.).
Definition: Craft.cpp:957
int getFuelPercentage() const
Gets the craft's percentage of fuel.
Definition: Craft.cpp:526
bool getMissionComplete() const
Gets whether the craft has just finished a mission.
Definition: Craft.cpp:589
void changeRules(RuleCraft *rules)
Sets the craft's ruleset.
Definition: Craft.cpp:288