OpenXcom
1.0
Open-source clone of the original X-Com
|
Represents a player base on the globe. More...
#include <Base.h>
Public Member Functions | |
Base (const Ruleset *rule) | |
Creates a new base. More... | |
~Base () | |
Cleans up the base. More... | |
void | load (const YAML::Node &node, SavedGame *save, bool newGame, bool newBattleGame=false) |
Loads the base from YAML. More... | |
YAML::Node | save () const |
Saves the base to YAML. More... | |
YAML::Node | saveId () const |
Saves the base's ID to YAML. More... | |
std::wstring | getName (Language *lang=0) const |
Gets the base's name. More... | |
void | setName (const std::wstring &name) |
Sets the base's name. More... | |
std::vector< BaseFacility * > * | getFacilities () |
Gets the base's facilities. More... | |
std::vector< Soldier * > * | getSoldiers () |
Gets the base's soldiers. More... | |
std::vector< Craft * > * | getCrafts () |
Gets the base's crafts. More... | |
std::vector< Transfer * > * | getTransfers () |
Gets the base's transfers. More... | |
ItemContainer * | getItems () |
Gets the base's items. More... | |
int | getScientists () const |
Gets the base's scientists. More... | |
void | setScientists (int scientists) |
Sets the base's scientists. More... | |
int | getEngineers () const |
Gets the base's engineers. More... | |
void | setEngineers (int engineers) |
Sets the base's engineers. More... | |
int | detect (Target *target) const |
Checks if a target is detected by the base's radar. More... | |
int | insideRadarRange (Target *target) const |
Checks if a target is inside the base's radar range. More... | |
int | getAvailableSoldiers (bool checkCombatReadiness=false) const |
Gets the base's available soldiers. More... | |
int | getTotalSoldiers () const |
Gets the base's total soldiers. More... | |
int | getAvailableScientists () const |
Gets the base's available scientists. More... | |
int | getTotalScientists () const |
Gets the base's total scientists. More... | |
int | getAvailableEngineers () const |
Gets the base's available engineers. More... | |
int | getTotalEngineers () const |
Gets the base's total engineers. More... | |
int | getUsedQuarters () const |
Gets the base's used living quarters. More... | |
int | getAvailableQuarters () const |
Gets the base's available living quarters. More... | |
double | getUsedStores () |
Gets the base's used storage space. More... | |
bool | storesOverfull (double offset=0.0) |
Checks if the base's stores are overfull. More... | |
int | getAvailableStores () const |
Gets the base's available storage space. More... | |
int | getUsedLaboratories () const |
Gets the base's used laboratory space. More... | |
int | getAvailableLaboratories () const |
Gets the base's available laboratory space. More... | |
int | getUsedWorkshops () const |
Gets the base's used workshop space. More... | |
int | getAvailableWorkshops () const |
Gets the base's available workshop space. More... | |
int | getUsedHangars () const |
Gets the base's used hangars. More... | |
int | getAvailableHangars () const |
Gets the base's available hangars. More... | |
int | getFreeLaboratories () const |
Get the number of available space lab (not used by a ResearchProject) More... | |
int | getFreeWorkshops () const |
Get the number of available space lab (not used by a Production) More... | |
int | getAllocatedScientists () const |
Returns the amount of scientists currently in use. More... | |
int | getAllocatedEngineers () const |
Returns the amount of engineers currently in use. More... | |
int | getDefenseValue () const |
Gets the base's defense value. More... | |
int | getShortRangeDetection () const |
Gets the base's short range detection. More... | |
int | getLongRangeDetection () const |
Gets the base's long range detection. More... | |
int | getCraftCount (const std::string &craft) const |
Gets the base's crafts of a certain type. More... | |
int | getCraftMaintenance () const |
Gets the base's craft maintenance. More... | |
int | getPersonnelMaintenance () const |
Gets the base's personnel maintenance. More... | |
int | getFacilityMaintenance () const |
Gets the base's facility maintenance. More... | |
int | getMonthlyMaintenace () const |
Gets the base's total monthly maintenance. More... | |
const std::vector < ResearchProject * > & | getResearch () const |
Get the list of base's ResearchProject. More... | |
void | addResearch (ResearchProject *) |
Add a new ResearchProject to the Base. More... | |
void | removeResearch (ResearchProject *) |
Remove a ResearchProject from the Base. More... | |
void | addProduction (Production *p) |
Add a new Production to Base. More... | |
void | removeProduction (Production *p) |
Remove a Base Production's. More... | |
const std::vector< Production * > & | getProductions () const |
Get the list of Base Production's. More... | |
bool | getHyperDetection () const |
Checks if this base is hyper-wave equipped. More... | |
int | getUsedPsiLabs () const |
Gets the base's used psi lab space. More... | |
int | getAvailablePsiLabs () const |
Gets the base's total available psi lab space. More... | |
int | getFreePsiLabs () const |
Gets the base's total free psi lab space. More... | |
int | getAvailableContainment () const |
Gets the total amount of Containment Space. More... | |
int | getUsedContainment () const |
Gets the total amount of used Containment Space. More... | |
void | setInBattlescape (bool inbattle) |
Sets the craft's battlescape status. More... | |
bool | isInBattlescape () const |
Gets if the craft is in battlescape. More... | |
void | setRetaliationTarget (bool mark=true) |
Mark this base for alien retaliation. More... | |
bool | getRetaliationTarget () const |
Gets the retaliation status of this base. More... | |
size_t | getDetectionChance (int difficulty) const |
Get the detection chance for this base. More... | |
int | getGravShields () const |
Gets how many Grav Shields the base has. | |
void | setupDefenses () |
Setup base defenses. | |
std::vector< BaseFacility * > * | getDefenses () |
Get a list of Defensive Facilities. | |
std::vector< Vehicle * > * | getVehicles () |
Gets the base's vehicles. More... | |
void | destroyDisconnectedFacilities () |
Destroys all disconnected facilities in the base. | |
std::list< std::vector < BaseFacility * >::iterator > | getDisconnectedFacilities (BaseFacility *remove) |
Gets a sorted list of the facilities(=iterators) NOT connected to the Access Lift. More... | |
void | destroyFacility (std::vector< BaseFacility * >::iterator facility) |
destroy a facility and deal with the side effects. 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::Target | |
Target () | |
Creates a target. More... | |
Represents a player base on the globe.
Bases can contain facilities, personnel, crafts and equipment.
OpenXcom::Base::Base | ( | const Ruleset * | rule | ) |
Creates a new base.
Initializes an empty base.
rule | Pointer to ruleset. |
OpenXcom::Base::~Base | ( | ) |
Cleans up the base.
Deletes the contents of the base from memory.
void OpenXcom::Base::addProduction | ( | Production * | p | ) |
Add a new Production to Base.
Add a new Production to the Base.
p | A pointer to a Production |
void OpenXcom::Base::addResearch | ( | ResearchProject * | project | ) |
Add a new ResearchProject to the Base.
Add A new ResearchProject to Base.
project | The project to add |
void OpenXcom::Base::destroyFacility | ( | std::vector< BaseFacility * >::iterator | facility | ) |
destroy a facility and deal with the side effects.
Removes a base module, and deals with the ramifications thereof.
facility | An iterator reference to the facility to destroy and remove. |
int OpenXcom::Base::detect | ( | Target * | target | ) | const |
Checks if a target is detected by the base's radar.
Returns if a certain target is covered by the base's radar range, taking in account the range and chance.
target | Pointer to target to compare. |
int OpenXcom::Base::getAllocatedEngineers | ( | ) | const |
Returns the amount of engineers currently in use.
int OpenXcom::Base::getAllocatedScientists | ( | ) | const |
Returns the amount of scientists currently in use.
int OpenXcom::Base::getAvailableContainment | ( | ) | const |
Gets the total amount of Containment Space.
Returns the total amount of Containment Space available in the base.
int OpenXcom::Base::getAvailableEngineers | ( | ) | const |
Gets the base's available engineers.
Returns the amount of engineers contained in the base without any assignments.
int OpenXcom::Base::getAvailableHangars | ( | ) | const |
Gets the base's available hangars.
Returns the total amount of hangars available in the base.
int OpenXcom::Base::getAvailableLaboratories | ( | ) | const |
Gets the base's available laboratory space.
Returns the total amount of laboratories available in the base.
int OpenXcom::Base::getAvailablePsiLabs | ( | ) | const |
Gets the base's total available psi lab space.
Returns the total amount of Psi Lab Space available in the base.
int OpenXcom::Base::getAvailableQuarters | ( | ) | const |
Gets the base's available living quarters.
Returns the total amount of living quarters available in the base.
int OpenXcom::Base::getAvailableScientists | ( | ) | const |
Gets the base's available scientists.
Returns the amount of scientists contained in the base without any assignments.
int OpenXcom::Base::getAvailableSoldiers | ( | bool | checkCombatReadiness = false | ) | const |
Gets the base's available soldiers.
Returns the amount of soldiers contained in the base without any assignments.
checkCombatReadiness | does what it says on the tin. |
int OpenXcom::Base::getAvailableStores | ( | ) | const |
Gets the base's available storage space.
Returns the total amount of stores available in the base.
int OpenXcom::Base::getAvailableWorkshops | ( | ) | const |
Gets the base's available workshop space.
Returns the total amount of workshops available in the base.
int OpenXcom::Base::getCraftCount | ( | const std::string & | craft | ) | const |
Gets the base's crafts of a certain type.
Returns the total amount of craft of a certain type stored in the base.
craft | Craft type. |
int OpenXcom::Base::getCraftMaintenance | ( | ) | const |
Gets the base's craft maintenance.
Returns the total amount of monthly costs for maintaining the craft in the base.
std::vector< Craft * > * OpenXcom::Base::getCrafts | ( | ) |
Gets the base's crafts.
Returns the list of crafts in the base.
int OpenXcom::Base::getDefenseValue | ( | ) | const |
Gets the base's defense value.
Returns the total defense value of all the facilities in the base.
size_t OpenXcom::Base::getDetectionChance | ( | int | difficulty | ) | const |
Get the detection chance for this base.
Calculate the detection chance of this base.
Big bases without mindshields are easier to detect.
difficulty | The savegame difficulty. |
std::list< std::vector< BaseFacility * >::iterator > OpenXcom::Base::getDisconnectedFacilities | ( | BaseFacility * | remove | ) |
Gets a sorted list of the facilities(=iterators) NOT connected to the Access Lift.
remove | Facility to ignore (in case of facility dismantling). |
int OpenXcom::Base::getEngineers | ( | ) | const |
Gets the base's engineers.
Returns the amount of engineers currently in the base.
std::vector< BaseFacility * > * OpenXcom::Base::getFacilities | ( | ) |
Gets the base's facilities.
Returns the list of facilities in the base.
int OpenXcom::Base::getFacilityMaintenance | ( | ) | const |
Gets the base's facility maintenance.
Returns the total amount of monthly costs for maintaining the facilities in the base.
int OpenXcom::Base::getFreeLaboratories | ( | ) | const |
Get the number of available space lab (not used by a ResearchProject)
Return laboratories space not used by a ResearchProject.
int OpenXcom::Base::getFreePsiLabs | ( | ) | const |
Gets the base's total free psi lab space.
Return psilab space not in use.
int OpenXcom::Base::getFreeWorkshops | ( | ) | const |
Get the number of available space lab (not used by a Production)
Return workshop space not used by a Production.
bool OpenXcom::Base::getHyperDetection | ( | ) | const |
Checks if this base is hyper-wave equipped.
Returns whether or not this base is equipped with hyper-wave detection facilities.
ItemContainer * OpenXcom::Base::getItems | ( | ) |
Gets the base's items.
Returns the list of items in the base.
int OpenXcom::Base::getLongRangeDetection | ( | ) | const |
Gets the base's long range detection.
Returns the total amount of long range detection facilities in the base.
int OpenXcom::Base::getMonthlyMaintenace | ( | ) | const |
Gets the base's total monthly maintenance.
Returns the total amount of all the maintenance monthly costs in the base.
|
virtual |
Gets the base's name.
Returns the custom name for the base.
lang | Language to get strings from. |
Implements OpenXcom::Target.
int OpenXcom::Base::getPersonnelMaintenance | ( | ) | const |
Gets the base's personnel maintenance.
Returns the total amount of monthly costs for maintaining the personnel in the base.
const std::vector< Production * > & OpenXcom::Base::getProductions | ( | ) | const |
Get the list of Base Production's.
const std::vector< ResearchProject * > & OpenXcom::Base::getResearch | ( | ) | const |
Get the list of base's ResearchProject.
Returns the list of all base's ResearchProject.
bool OpenXcom::Base::getRetaliationTarget | ( | ) | const |
Gets the retaliation status of this base.
Get the base's retaliation status.
int OpenXcom::Base::getScientists | ( | ) | const |
Gets the base's scientists.
Returns the amount of scientists currently in the base.
int OpenXcom::Base::getShortRangeDetection | ( | ) | const |
Gets the base's short range detection.
Returns the total amount of short range detection facilities in the base.
std::vector< Soldier * > * OpenXcom::Base::getSoldiers | ( | ) |
Gets the base's soldiers.
Returns the list of soldiers in the base.
int OpenXcom::Base::getTotalEngineers | ( | ) | const |
Gets the base's total engineers.
Returns the total amount of engineers contained in the base.
int OpenXcom::Base::getTotalScientists | ( | ) | const |
Gets the base's total scientists.
Returns the total amount of scientists contained in the base.
int OpenXcom::Base::getTotalSoldiers | ( | ) | const |
Gets the base's total soldiers.
Returns the total amount of soldiers contained in the base.
std::vector< Transfer * > * OpenXcom::Base::getTransfers | ( | ) |
Gets the base's transfers.
Returns the list of transfers destined to this base.
int OpenXcom::Base::getUsedContainment | ( | ) | const |
Gets the total amount of used Containment Space.
Returns the total amount of used Containment Space in the base.
int OpenXcom::Base::getUsedHangars | ( | ) | const |
Gets the base's used hangars.
Returns the amount of hangars used up by crafts in the base.
int OpenXcom::Base::getUsedLaboratories | ( | ) | const |
Gets the base's used laboratory space.
Returns the amount of laboratories used up by research projects in the base.
int OpenXcom::Base::getUsedPsiLabs | ( | ) | const |
Gets the base's used psi lab space.
Returns the total amount of used Psi Lab Space in the base.
int OpenXcom::Base::getUsedQuarters | ( | ) | const |
Gets the base's used living quarters.
Returns the amount of living quarters used up by personnel in the base.
double OpenXcom::Base::getUsedStores | ( | ) |
Gets the base's used storage space.
Returns the amount of stores used up by equipment in the base, and equipment about to arrive.
int OpenXcom::Base::getUsedWorkshops | ( | ) | const |
Gets the base's used workshop space.
Returns the amount of workshops used up by manufacturing projects in the base.
std::vector< Vehicle * > * OpenXcom::Base::getVehicles | ( | ) |
Gets the base's vehicles.
Returns the list of vehicles currently equipped in the base.
int OpenXcom::Base::insideRadarRange | ( | Target * | target | ) | const |
Checks if a target is inside the base's radar range.
Returns if a certain target is inside the base's radar range, taking in account the positions of both.
target | Pointer to target to compare. |
bool OpenXcom::Base::isInBattlescape | ( | ) | const |
Gets if the craft is in battlescape.
Returns the base's battlescape status.
void OpenXcom::Base::load | ( | const YAML::Node & | node, |
SavedGame * | save, | ||
bool | newGame, | ||
bool | newBattleGame = false |
||
) |
Loads the base from YAML.
Loads the base from a YAML file.
node | YAML node. |
save | Pointer to saved game. |
newGame | Is this the first base of a new game? |
newBattleGame | Is this the base of a skirmish game? |
void OpenXcom::Base::removeProduction | ( | Production * | p | ) |
Remove a Base Production's.
Remove a Production from the Base.
p | A pointer to a Production |
void OpenXcom::Base::removeResearch | ( | ResearchProject * | project | ) |
Remove a ResearchProject from the Base.
Remove a ResearchProject from base.
project | the project to remove |
|
virtual |
Saves the base to YAML.
Saves the base to a YAML file.
Reimplemented from OpenXcom::Target.
|
virtual |
Saves the base's ID to YAML.
Saves the base's unique identifiers to a YAML file.
Reimplemented from OpenXcom::Target.
void OpenXcom::Base::setEngineers | ( | int | engineers | ) |
Sets the base's engineers.
Changes the amount of engineers currently in the base.
engineers | Number of engineers. |
void OpenXcom::Base::setInBattlescape | ( | bool | inbattle | ) |
Sets the craft's battlescape status.
Changes the base's battlescape status.
inbattle | True if it's in battle, False otherwise. |
void OpenXcom::Base::setName | ( | const std::wstring & | name | ) |
Sets the base's name.
Changes the custom name for the base.
name | Name. |
void OpenXcom::Base::setRetaliationTarget | ( | bool | mark = true | ) |
Mark this base for alien retaliation.
Mark the base as a valid alien retaliation target.
mark | Mark (if true ) or unmark (if false ) the base. |
void OpenXcom::Base::setScientists | ( | int | scientists | ) |
Sets the base's scientists.
Changes the amount of scientists currently in the base.
scientists | Number of scientists. |
bool OpenXcom::Base::storesOverfull | ( | double | offset = 0.0 | ) |
Checks if the base's stores are overfull.
Supplying an offset will add/subtract to the used capacity before performing the check. A positive offset simulates adding items to the stores, whereas a negative offset can be used to check whether sufficient items have been removed to stop the stores overflowing.
offset | Adjusts the used capacity. |