|
UFO: Alien Invasion
|
Handles everything that is located in or accessed trough a base. More...
#include "../../DateTime.h"#include "../../cl_shared.h"#include "../../cl_inventory.h"#include "../../ui/ui_dataids.h"#include "../../../shared/parse.h"#include "cp_campaign.h"#include "cp_mapfightequip.h"#include "cp_aircraft.h"#include "cp_missions.h"#include "cp_geoscape.h"#include "cp_popup.h"#include "cp_radar.h"#include "cp_time.h"#include "cp_base_callbacks.h"#include "cp_ufo.h"#include "save/save_base.h"#include "aliencontainment.h"#include "itemcargo.h"
Go to the source code of this file.
Macros | |
| #define | B_GetBuildingByIDX(baseIdx, buildingIdx) |
| #define | B_GetBuildingIDX(base, building) |
| #define | B_GetBaseIDX(base) |
Functions | |
| static void | B_InitialEquipment (aircraft_t *aircraft, const equipDef_t *ed) |
| Prepares initial equipment for initial team the beginning of the campaign. | |
| static linkedList_t * | B_GetNeighbours (const building_t *building) |
| Returns the neighbourhood of a building. | |
| static bool | B_AddBlockedTile (base_t *base, int row, int column) |
| Check and add blocked tile to the base. | |
| static void | B_AddBlockedTiles (base_t *base, int count) |
| Fuction to put blocked tiles on basemap. | |
| bool | B_IsBuildingDestroyable (const building_t *building) |
| Returns if a base building is destroyable. | |
| int | B_GetCount (void) |
| Returns the count of founded bases. | |
| base_t * | B_GetNext (base_t *lastBase) |
| Iterates through founded bases. | |
| base_t * | B_GetBaseByIDX (int baseIdx) |
| Array bound check for the base index. Will also return unfounded bases as long as the index is in the valid ranges,. | |
| base_t * | B_GetFoundedBaseByIDX (int baseIdx) |
| Array bound check for the base index. | |
| building_t * | B_GetNextBuilding (const base_t *base, building_t *lastBuilding) |
| Iterates through buildings in a base. | |
| building_t * | B_GetNextBuildingByType (const base_t *base, building_t *lastBuilding, buildingType_t buildingType) |
| Iterates throught buildings of a type in a base. | |
| bool | B_CheckBuildingTypeStatus (const base_t *const base, buildingType_t type, buildingStatus_t status, int *cnt) |
| Searches the base for a given building type with the given status. | |
| baseCapacities_t | B_GetCapacityFromBuildingType (buildingType_t type) |
| Get the capacity associated to a building type. | |
| buildingType_t | B_GetBuildingTypeByCapacity (baseCapacities_t cap) |
| Get building type by base capacity. | |
| bool | B_GetBuildingStatus (const base_t *const base, const buildingType_t buildingType) |
| Get the status associated to a building. | |
| void | B_SetBuildingStatus (base_t *const base, const buildingType_t buildingType, bool newStatus) |
| Set status associated to a building. | |
| float | B_GetMaxBuildingLevel (const base_t *base, const buildingType_t type) |
| Get the maximum level of a building type in a base. | |
| static void | B_AddMap (char *maps, size_t mapsLength, char *coords, size_t coordsLength, const char *map, int col, int row) |
| Adds a map to the given position to the map string. | |
| bool | B_AssembleMap (char *maps, size_t mapsLength, char *coords, size_t coordsLength, const base_t *base) |
| Perform the base assembling in case of an alien attack. | |
| static bool | B_CheckUpdateBuilding (building_t *building) |
| Check base status for particular buildings as well as capacities. | |
| static bool | B_UpdateStatusBuilding (base_t *base, buildingType_t buildingType, bool onBuilt) |
| Update status of every building when a building has been built/destroyed. | |
| static void | B_UpdateAntimatterCap (base_t *base) |
| Update Antimatter Capacity. | |
| void | B_ResetAllStatusAndCapacities (base_t *base, bool firstEnable) |
| Recalculate status and capacities of one base. | |
| bool | B_BuildingDestroy (building_t *building) |
| Removes a building from the given base. | |
| static void | B_MoveAircraftOnGeoscapeToOtherBases (const base_t *base) |
| Will ensure that aircraft on geoscape are not stored in a base that no longer has any hangar left. | |
| void | B_Delete (base_t *base) |
| Resets a base structure. | |
| void | B_Destroy (base_t *base) |
| Destroy a base. | |
| static void | B_UpdateAllBaseBuildingStatus (building_t *building, buildingStatus_t status) |
| Updates base status for particular buildings as well as capacities. | |
| static void | B_AddBuildingToBasePos (base_t *base, const building_t *buildingTemplate, bool hire, const vec2_t pos) |
| Build starting building in the first base, and hire employees. | |
| static void | B_BuildFromTemplate (base_t *base, const char *templateName, bool hire) |
| builds a base from template | |
| void | B_SetUpFirstBase (const campaign_t *campaign, base_t *base) |
| Setup aircraft and equipment for first base. Uses the campaign scriptable equipmentlist. | |
| int | B_GetInstallationLimit (void) |
| Counts the actual installation count limit. | |
| void | B_SetName (base_t *base, const char *name) |
| Set the base name. | |
| base_t * | B_Build (const campaign_t *campaign, const vec2_t pos, const char *name, bool fillBase) |
| Build new base, uses template for the first base. | |
| const baseTemplate_t * | B_GetBaseTemplate (const char *baseTemplateID) |
| Returns the baseTemplate in the global baseTemplate list that has the unique name baseTemplateID. | |
| bool | B_MapIsCellFree (const base_t *base, int col, int row) |
| Check a base cell. | |
| building_t * | B_BuildBuilding (base_t *base, const building_t *buildingTemplate, int col, int row) |
| Build a new building to the base. | |
| int | B_GetNumberOfBuildingsInBaseByTemplate (const base_t *base, const building_t *tpl) |
| Counts the number of buildings of a particular type in a base. | |
| int | B_GetNumberOfBuildingsInBaseByBuildingType (const base_t *base, const buildingType_t buildingType) |
| Counts the number of buildings of a particular building type in a base. | |
| const building_t * | B_GetBuildingInBaseByType (const base_t *base, buildingType_t buildingType, bool onlyWorking) |
| Gets a building of a given type in the given base. | |
| void | B_ParseBaseTemplate (const char *name, const char **text) |
| Reads a base layout template. | |
| base_t * | B_GetFirstUnfoundedBase (void) |
| Get the first unfounded base. | |
| void | B_SetCurrentSelectedBase (const base_t *base) |
| Sets the selected base. | |
| base_t * | B_GetCurrentSelectedBase (void) |
| returns the currently selected base | |
| void | B_SelectBase (const base_t *base) |
| Select and opens a base. | |
| static void | CL_SwapSkill (character_t *cp1, character_t *cp2, abilityskills_t skill) |
| Swaps one skill from character1 to character 2 and vice versa. | |
| static void | CL_DoSwapSkills (character_t *cp1, character_t *cp2, const abilityskills_t skill) |
| static int | CL_GetSkillIndicator (const character_t *chr, abilityskills_t skill) |
| Assembles a skill indicator for the given character and its wore weapons in correlation to the given skill. | |
| static void | CL_SwapSkills (linkedList_t *team) |
| Swaps skills of the initial team of soldiers so that they match inventories. | |
| void | B_BaseResetStatus (base_t *const base) |
| Sets the baseStatus to BASE_NOT_USED. | |
| void | B_InitStartup (void) |
| Resets console commands. | |
| static bool | B_CheckBuildingConstruction (building_t *building) |
| Checks whether the construction of a building is finished. Calls the onEnable functions and assign workers, too. | |
| void | B_UpdateBuildingConstructions (void) |
| Updates base data. | |
| static void | B_SellOrAddItems (aircraft_t *aircraft) |
| Sell items to the market or add them to base storage. | |
| void | B_DumpAircraftToHomeBase (aircraft_t *aircraft) |
| Will unload all cargo to the homebase. | |
| void | B_AircraftReturnedToHomeBase (aircraft_t *aircraft) |
| Do anything when dropship returns to base. | |
| bool | B_BaseHasItem (const base_t *base, const objDef_t *item) |
| Check if an item is available on a base. | |
| int | B_ItemInBase (const objDef_t *item, const base_t *base) |
| Check if the item has been collected (i.e it is in the storage) in the given base. | |
| void | B_UpdateBaseCapacities (baseCapacities_t cap, base_t *base) |
| Updates base capacities. | |
| void | B_SaveBaseSlotsXML (const baseWeapon_t *weapons, const int numWeapons, xmlNode_t *node) |
| Saves the missile and laser slots of a base or sam site. | |
| bool | B_SaveStorageXML (xmlNode_t *parent, const equipDef_t &equip) |
| Saves base storage. | |
| bool | B_SaveXML (xmlNode_t *parent) |
| Save callback for saving in xml format. | |
| int | B_LoadBaseSlotsXML (baseWeapon_t *weapons, int max, xmlNode_t *p) |
| Loads the missile and laser slots of a base or sam site. | |
| static bool | B_PostLoadInitCapacity (void) |
| Set the capacity stuff for all the bases after loading a savegame. | |
| bool | B_PostLoadInit (void) |
| Set the capacity stuff for all the bases after loading a savegame. | |
| bool | B_LoadStorageXML (xmlNode_t *parent, equipDef_t *equip) |
| Loads base storage. | |
| bool | B_LoadXML (xmlNode_t *parent) |
| Loads base data. | |
| bool | B_ItemIsStoredInBaseStorage (const objDef_t *obj) |
| Check if an item is stored in storage. | |
| int | B_AddToStorage (base_t *base, const objDef_t *obj, int amount) |
| Add/remove items to/from the storage. | |
| int | B_AntimatterInBase (const base_t *base) |
| returns the amount of antimatter stored in a base | |
| int | B_AddAntimatter (base_t *base, int amount) |
| Manages antimatter (adding, removing) through Antimatter Storage Facility. | |
Handles everything that is located in or accessed trough a base.
Definition in file cp_base.cpp.
| #define B_GetBaseIDX | ( | base | ) |
Definition at line 48 of file cp_base.cpp.
| #define B_GetBuildingByIDX | ( | baseIdx, | |
| buildingIdx ) |
Definition at line 46 of file cp_base.cpp.
Referenced by B_BuildBuilding(), B_Destroy(), B_GetNextBuilding(), and B_LoadXML().
| #define B_GetBuildingIDX | ( | base, | |
| building ) |
Definition at line 47 of file cp_base.cpp.
Referenced by B_BuildBuilding(), and B_LoadXML().
Manages antimatter (adding, removing) through Antimatter Storage Facility.
| [in,out] | base | Pointer to the base. |
| [in] | amount | quantity of antimatter to add/remove |
Definition at line 2635 of file cp_base.cpp.
References ANTIMATTER_ITEM_ID, B_AntimatterInBase(), CAP_ANTIMATTER, CAP_Get, cgi, capacities_t::cur, ERR_DROP, objDef_t::idx, INVSH_GetItemByIDSilent(), equipDef_t::numItems, and base_t::storage.
Referenced by AIR_Refuel(), CAP_RemoveAntimatterExceedingCapacity(), PR_FinishDisassembly(), PR_UpdateRequiredItemsInBasestorage(), TR_EmptyTransferCargo(), and TR_TransferStart().
Check and add blocked tile to the base.
| [in,out] | base | The base to add blocked tile to |
| [in] | row | Row position of the tile |
| [in] | column | Column position of the tile |
Definition at line 138 of file cp_base.cpp.
References B_GetBuildingAt, B_IsTileBlocked, BASE_SIZE, baseBuildingTile_t::blocked, cgi, linkedList_t::data, base_t::map, OBJZERO, baseBuildingTile_t::posX, and baseBuildingTile_t::posY.
Referenced by B_AddBlockedTiles().
Fuction to put blocked tiles on basemap.
| [out] | base | The base to fill |
| [in] | count | Number of blocked tiles to add |
Definition at line 202 of file cp_base.cpp.
References B_AddBlockedTile(), B_GetBuildingAt, B_IsTileBlocked, BASE_SIZE, and count.
Referenced by B_BuildFromTemplate().
|
static |
Build starting building in the first base, and hire employees.
| [in,out] | base | The base to put the new building into |
| [in] | buildingTemplate | The building template to create a new building with |
| [in] | hire | Hire employees for the building we create from the template |
| [in] | pos | The position on the base grid |
Definition at line 1011 of file cp_base.cpp.
References B_BuildBuilding(), B_FireEvent(), B_ONENABLE, B_STATUS_WORKING, B_UpdateAllBaseBuildingStatus(), cgi, DEBUG_CLIENT, E_HireForBuilding(), building_t::id, base_t::idx, building_t::onEnable, building_t::pos, and building_t::timeStart.
Referenced by B_BuildFromTemplate().
|
inlinestatic |
Adds a map to the given position to the map string.
| [out] | maps | The map output string |
| [in] | mapsLength | The length of the maps string |
| [out] | coords | The coords output string |
| [in] | coordsLength | The length of the coords string |
| [in] | map | The map tile to add |
| [in] | col | The col to spawn the map at |
| [in] | row | The row to spawn the map at |
Definition at line 545 of file cp_base.cpp.
References BASE_SIZE, BASE_TILE_UNITS, and Q_strcat().
Referenced by B_AssembleMap().
Add/remove items to/from the storage.
| [in] | base | The base which storage and capacity should be updated |
| [in] | obj | The item. |
| [in] | amount | Amount to be added to removed |
Definition at line 2576 of file cp_base.cpp.
References B_ItemInBase(), B_ItemIsStoredInBaseStorage(), technology_t::base, CAP_Get, CAP_ITEMS, capacities_t::cur, objDef_t::idx, equipDef_t::numItems, RS_GetTechForItem(), RS_RUNNING, RS_StopResearch(), objDef_t::size, technology_t::statusResearch, and base_t::storage.
Referenced by AII_AddAmmoToSlot(), AII_AddItemToSlot(), AII_ReloadWeapon(), AII_RemoveItemFromSlot(), AII_RemoveNextItemFromSlot(), AIR_TransferItemsCarriedByCharacterToBase(), B_SellOrAddItems(), BS_BuyItem(), BS_BuyUGV(), BS_SellItem(), BS_SellUGV(), E_RemoveInventoryFromStorage(), PR_FinishDisassembly(), PR_FinishProduction(), PR_UpdateRequiredItemsInBasestorage(), TR_EmptyTransferCargo(), and TR_TransferStart().
| void B_AircraftReturnedToHomeBase | ( | aircraft_t * | aircraft | ) |
Do anything when dropship returns to base.
| [in] | aircraft | Returning aircraft. |
Definition at line 2102 of file cp_base.cpp.
References AII_ReloadAircraftWeapons(), AIRFIGHT_RemoveProjectileAimingAircraft(), B_DumpAircraftToHomeBase(), aircraft_t::radar, and RADAR_InitialiseUFOs().
Referenced by AIR_Move().
returns the amount of antimatter stored in a base
| [in] | base | Pointer to the base to check |
Definition at line 2613 of file cp_base.cpp.
References ANTIMATTER_ITEM_ID, B_ItemInBase(), CAP_ANTIMATTER, CAP_GetCurrent, cgi, ERR_DROP, and INVSH_GetItemByID().
Referenced by B_AddAntimatter(), PR_RequirementsInfo(), PR_RequirementsMet(), RS_RequirementsMet(), TR_Add_f(), and TR_FillItems().
| bool B_AssembleMap | ( | char * | maps, |
| size_t | mapsLength, | ||
| char * | coords, | ||
| size_t | coordsLength, | ||
| const base_t * | base ) |
Perform the base assembling in case of an alien attack.
| [out] | maps | The string containing the list of tilenames |
| [in] | mapsLength | The maximum length of maps string |
| [out] | coords | The string containing the positions of the tiles |
| [in] | coordsLength | The maximum length of coords string |
| [in,out] | base | The base to assemble |
true if the assembly was successful, false if it failed Search a empty field and add a alien craft there
If a building is still under construction, it will be assembled as a finished part. Otherwise we need mapparts for all the maps under construction.
Definition at line 563 of file cp_base.cpp.
References B_AddMap(), B_GetBuildingAt, B_IsBuildingBuiltUp(), BASE_SIZE, cgi, ERR_DROP, building_t::id, building_t::mapPart, building_t::pos, and va().
Referenced by B_AssembleMap_f(), BATTLE_Start(), and TEST_F().
Check if an item is available on a base.
| [in] | base | Pointer to the base to check at |
| [in] | item | Pointer to the item to check |
Definition at line 2119 of file cp_base.cpp.
References B_ItemInBase(), and objDef_t::isVirtual.
Referenced by AII_AddAmmoToSlot(), AII_AddItemToSlot(), AII_ReloadWeapon(), AIM_AutoEquipAircraft(), AIM_CheckTechnologyIntoSlot(), AIM_CrafttypeFilter(), and AIM_SelectableCraftItem().
Sets the baseStatus to BASE_NOT_USED.
| [in] | base | Which base should be reseted? |
Definition at line 1789 of file cp_base.cpp.
References BASE_NOT_USED, and base_t::baseStatus.
| base_t * B_Build | ( | const campaign_t * | campaign, |
| const vec2_t | pos, | ||
| const char * | name, | ||
| bool | fillBase ) |
Build new base, uses template for the first base.
| [in] | campaign | The campaign data structure |
| [in] | pos | Position (on Geoscape) the base built at |
| [in] | name | The name of the new base, this string might already be in utf-8 |
| [in] | fillBase | Whether we should build default buildings at the base |
Definition at line 1185 of file cp_base.cpp.
References base_t::alienInterest, B_BuildFromTemplate(), B_GetFirstUnfoundedBase(), B_GetMaxBuildingLevel(), B_RADAR, B_ResetAllStatusAndCapacities(), B_SetCurrentSelectedBase(), B_SetName(), BASE_INITIALINTEREST, BASE_WORKING, base_t::baseStatus, BDEF_InitialiseBaseSlots(), CAP_SetCurrent(), ccs, cgi, ERR_DROP, campaign_t::firstBaseTemplate, base_t::founded, i, base_t::idx, level, MAX_CAP, name, base_t::pos, PR_UpdateProductionCap(), base_t::radar, RADAR_BASERANGE, RADAR_BASETRACKINGRANGE, RADAR_Initialise(), RADAR_InitialiseUFOs(), and Vector2Copy.
Referenced by B_BuildBase_f(), and CreateBase().
| building_t * B_BuildBuilding | ( | base_t * | base, |
| const building_t * | buildingTemplate, | ||
| int | col, | ||
| int | row ) |
Build a new building to the base.
| [in,out] | base | The base to place the building in |
| [in] | buildingTemplate | The template of the building to place at the given location |
| [in] | row | Set building to row |
| [in] | col | Set building to col |
Definition at line 1279 of file cp_base.cpp.
References B_FireEvent(), B_GetBuildingAt, B_GetBuildingByIDX, B_GetBuildingIDX, B_GetNeighbours(), B_IsBuildingBuiltUp(), B_IsTileBlocked, B_ONCONSTRUCT, B_STATUS_UNDER_CONSTRUCTION, building_t::base, BASE_SIZE, BASE_WORKING, base_t::baseStatus, baseBuildingTile_t::building, building_t::buildingStatus, ccs, cgi, CP_CheckCredits(), CP_UpdateCredits(), ERR_DROP, building_t::fixCosts, base_t::idx, building_t::idx, LIST_Foreach, base_t::map, building_t::pos, building_t::size, and building_t::timeStart.
Referenced by B_AddBuildingToBasePos(), B_BuildBuilding_f(), and TEST_F().
builds a base from template
| [out] | base | The base to build |
| [in] | templateName | Template used for building. If nullptr no template will be used. |
| [in] | hire | If hiring employee needed |
Definition at line 1040 of file cp_base.cpp.
References B_AddBlockedTiles(), B_AddBuildingToBasePos(), B_GetBaseTemplate(), B_GetBuildingStatus(), BASE_SIZE, baseBuildingTile_t::building, baseTemplate_t::buildings, building_t::buildingType, ccs, cgi, ERR_DROP, frand(), i, building_t::mandatory, base_t::map, MAX_BLOCKEDFIELDS, MIN_BLOCKEDFIELDS, baseTemplate_t::numBuildings, baseBuildingTile_t::posX, baseBuildingTile_t::posY, and Vector2Set.
Referenced by B_Build().
| bool B_BuildingDestroy | ( | building_t * | building | ) |
Removes a building from the given base.
| [in] | building | The building to remove |
Definition at line 771 of file cp_base.cpp.
References B_FireEvent(), B_GetCapacityFromBuildingType(), B_GetNumberOfBuildingsInBaseByBuildingType(), B_IsBuildingDestroyable(), B_MISC, B_ONDESTROY, B_ONDISABLE, B_SetBuildingStatus(), B_STATUS_NOT_SET, B_STATUS_WORKING, B_UpdateBaseCapacities(), B_UpdateStatusBuilding(), building_t::base, baseBuildingTile_t::building, building_t::buildingStatus, building_t::buildingType, CAP_CheckOverflow(), ccs, cgi, CP_UpdateCredits(), DEBUG_CLIENT, ERR_DROP, building_t::fixCosts, i, base_t::idx, building_t::idx, building_t::mandatory, base_t::map, MAX_BUILDING_TYPE, MAX_CAP, building_t::onDestroy, building_t::onDisable, building_t::pos, REMOVE_ELEM, building_t::size, and building_t::tpl.
Referenced by B_BuildingDestroy_f(), B_Destroy(), and TEST_F().
|
static |
Checks whether the construction of a building is finished. Calls the onEnable functions and assign workers, too.
Definition at line 1987 of file cp_base.cpp.
References B_FireEvent(), B_IsBuildingBuiltUp(), B_ONENABLE, B_STATUS_UNDER_CONSTRUCTION, B_STATUS_WORKING, B_UpdateAllBaseBuildingStatus(), building_t::base, building_t::buildingStatus, cgi, DEBUG_CLIENT, base_t::idx, and building_t::onEnable.
Referenced by B_UpdateBuildingConstructions().
| bool B_CheckBuildingTypeStatus | ( | const base_t *const | base, |
| buildingType_t | type, | ||
| buildingStatus_t | status, | ||
| int * | cnt ) |
Searches the base for a given building type with the given status.
| [in] | base | Base to search |
| [in] | type | Building type to search |
| [in] | status | The status the building should have |
| [out] | cnt | This is a pointer to an int value which will hold the building count of that type with the status you are searching - might also be nullptr if you are not interested in this value |
if (hasBuilding[B_QUARTERS]) check - this should speed things up a lot Definition at line 390 of file cp_base.cpp.
References B_GetNextBuildingByType(), building_t::buildingStatus, and type.
Referenced by BDEF_UpdateActiveBattery_f().
|
static |
Check base status for particular buildings as well as capacities.
| [in] | building | Pointer to building. |
Definition at line 600 of file cp_base.cpp.
References B_CheckBuildingDependencesStatus(), B_GetBuildingStatus(), B_MISC, B_SetBuildingStatus(), B_STATUS_WORKING, building_t::base, building_t::buildingStatus, building_t::buildingType, cgi, DEBUG_CLIENT, and building_t::name.
Referenced by B_ResetAllStatusAndCapacities(), B_UpdateAllBaseBuildingStatus(), and B_UpdateStatusBuilding().
Resets a base structure.
| [in,out] | base | Pointer to base to be deleted. |
Definition at line 898 of file cp_base.cpp.
References base_t::alienContainment.
Referenced by B_Destroy(), and CP_ResetCampaignData().
Destroy a base.
| [in,out] | base | Pointer to base to be destroyed. |
Definition at line 914 of file cp_base.cpp.
References AIR_DeleteAircraft(), AIR_ForeachFromBase, base_t::alienInterest, B_BuildingDestroy(), B_Delete(), B_GetBuildingByIDX, B_MoveAircraftOnGeoscapeToOtherBases(), BASE_DESTROYED, base_t::baseStatus, CAP_ITEMS, CAP_SetCurrent(), ccs, CP_MissionNotifyBaseDestroyed(), E_DeleteAllEmployees(), base_t::idx, OBJZERO, and base_t::storage.
Referenced by B_Destroy_AntimaterStorage_f(), CP_BaseAttackMissionDestroyBase(), TEST_F(), and TEST_F().
| void B_DumpAircraftToHomeBase | ( | aircraft_t * | aircraft | ) |
Will unload all cargo to the homebase.
| [in,out] | aircraft | The aircraft to dump |
Definition at line 2084 of file cp_base.cpp.
References AL_AddAliens(), B_SellOrAddItems(), and aircraft_t::maxTeamSize.
Referenced by B_AircraftReturnedToHomeBase(), CP_EndRescueMission(), and CP_MissionEndActions().
Array bound check for the base index. Will also return unfounded bases as long as the index is in the valid ranges,.
| [in] | baseIdx | Index to check |
Definition at line 313 of file cp_base.cpp.
References ccs, and MAX_BASES.
Referenced by AIR_LoadAircraftXML(), B_BuildBuilding_f(), B_FillBuildingInfo_f(), B_GetFirstUnfoundedBase(), B_GetFoundedBaseByIDX(), B_ListBuildings_f(), B_LoadXML(), BDEF_AddBattery_f(), BDEF_UpdateActiveBattery_f(), CP_AddItemAsCollected_f(), E_LoadXML(), GAME_CP_DrawBaseLayout(), MIS_LoadXML(), PR_LoadXML(), RS_LoadXML(), and TR_LoadXML().
| const baseTemplate_t * B_GetBaseTemplate | ( | const char * | baseTemplateID | ) |
Returns the baseTemplate in the global baseTemplate list that has the unique name baseTemplateID.
| [in] | baseTemplateID | The unique id of the building (baseTemplate_t->name). |
Definition at line 1246 of file cp_base.cpp.
References ccs, cgi, i, and Q_streq.
Referenced by B_BuildFromTemplate().
| const building_t * B_GetBuildingInBaseByType | ( | const base_t * | base, |
| buildingType_t | buildingType, | ||
| bool | onlyWorking ) |
Gets a building of a given type in the given base.
| [in] | base | The base to search the building in |
| [in] | buildingType | What building-type to get. |
| [in] | onlyWorking | If we're looking only for working buildings |
Definition at line 1414 of file cp_base.cpp.
References B_GetBuildingStatus(), and B_GetNextBuildingByType().
| bool B_GetBuildingStatus | ( | const base_t *const | base, |
| const buildingType_t | buildingType ) |
Get the status associated to a building.
| [in] | base | The base to search for the given building type |
| [in] | buildingType | value of building->buildingType |
Definition at line 478 of file cp_base.cpp.
References B_MISC, cgi, base_t::hasBuilding, and MAX_BUILDING_TYPE.
Referenced by AII_BaseCanShoot(), AIM_AircraftStart_f(), AIR_AircraftAllowed(), AIR_CanIntercept(), AIR_CheckMoveIntoNewHomebase(), AIRFIGHT_CampaignRunBaseDefence(), B_BuildFromTemplate(), B_BuildingOpenAfterClick_f(), B_CheckBuildingDependencesStatus(), B_CheckUpdateBuilding(), B_GetBuildingInBaseByType(), B_GetInstallationLimit(), B_GetMaxBuildingLevel(), B_ResetAllStatusAndCapacities(), B_UpdateStatusBuilding(), BS_Buy_f(), BS_BuySellAllowed(), CL_PopupInterceptClick_f(), CP_BaseAttackChooseBase(), E_HireAllowed(), HOS_HospitalAllowed(), HOS_HospitalRun(), HOS_Init_f(), PR_ProductionAllowed(), RS_ResearchAllowed(), TEST_F(), TEST_F(), TEST_F(), TR_EmptyTransferCargo(), and UFO_CampaignCheckEvents().
| buildingType_t B_GetBuildingTypeByCapacity | ( | baseCapacities_t | cap | ) |
Get building type by base capacity.
| [in] | cap | Enum type of baseCapacities_t. |
Definition at line 447 of file cp_base.cpp.
References B_ALIEN_CONTAINMENT, B_ANTIMATTER, B_HANGAR, B_LAB, B_QUARTERS, B_SMALL_HANGAR, B_STORAGE, B_WORKSHOP, CAP_AIRCRAFT_BIG, CAP_AIRCRAFT_SMALL, CAP_ALIENS, CAP_ANTIMATTER, CAP_EMPLOYEES, CAP_ITEMS, CAP_LABSPACE, CAP_WORKSPACE, and MAX_BUILDING_TYPE.
Referenced by AIR_CheckMoveIntoNewHomebase(), B_ResetAllStatusAndCapacities(), B_UpdateBaseCapacities(), CAP_CheckOverflow(), and UP_AircraftDescription().
| baseCapacities_t B_GetCapacityFromBuildingType | ( | buildingType_t | type | ) |
Get the capacity associated to a building type.
| [in] | type | The type of the building |
Definition at line 416 of file cp_base.cpp.
References B_ALIEN_CONTAINMENT, B_ANTIMATTER, B_HANGAR, B_LAB, B_QUARTERS, B_SMALL_HANGAR, B_STORAGE, B_WORKSHOP, CAP_AIRCRAFT_BIG, CAP_AIRCRAFT_SMALL, CAP_ALIENS, CAP_ANTIMATTER, CAP_EMPLOYEES, CAP_ITEMS, CAP_LABSPACE, CAP_WORKSPACE, MAX_CAP, and type.
Referenced by AIR_GetHangarCapacityType(), B_BuildingDestroy(), B_BuildingDestroy_f(), B_ListBuildings_f(), B_UpdateAllBaseBuildingStatus(), and TR_DestinationCapacityList_f().
Returns the count of founded bases.
Definition at line 277 of file cp_base.cpp.
References ccs.
Referenced by B_BaseInit_f(), B_BuildBase_f(), B_BuildingDestroy_f(), B_BuildingOpenAfterClick_f(), B_GetFoundedBaseByIDX(), B_GetNext(), B_InitCallbacks(), B_LoadXML(), B_SelectBase(), B_SetBaseTitle_f(), BDEF_RemoveBattery_f(), GEO_Click(), GEO_GetGeoscapeAngle(), and INS_FillTypes_f().
returns the currently selected base
Definition at line 1578 of file cp_base.cpp.
References B_GetNext(), and base_t::selected.
Referenced by AC_Init_f(), AC_KillAll_f(), AC_KillOne_f(), AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipMenuUpdate(), AIM_AircraftEquipRemoveItem_f(), AIM_AircraftEquipSlotSelect_f(), AIM_AircraftEquipZoneSelect_f(), AIM_AircraftReturnToBase_f(), AIM_AircraftStart_f(), AIM_SelectAircraft_f(), AIM_UpdateItemDescription(), AIR_AircraftFillList_f(), AIR_ChangeAircraftName_f(), B_BaseInit_f(), BDEF_AddItem_f(), BDEF_BaseDefenceMenuUpdate_f(), BDEF_ChangeAutoFire(), BDEF_RemoveItem_f(), BDEF_SelectItem_f(), BS_Buy_f(), BS_FillMarket_f(), CP_TEAM_AssignSoldierByUCN_f(), CP_TEAM_DeEquipActor_f(), CP_TEAM_FillBDEFEmployeeList_f(), CP_TEAM_FillEmployeeList_f(), CP_TEAM_FillEquipSoldierList_f(), CP_TEAM_SelectActorByUCN_f(), E_EmployeeHire_f(), E_EmployeeList_f(), E_EmployeeSelect(), E_UpdateGUICount_f(), PR_ProductionDecrease_f(), PR_ProductionDown_f(), PR_ProductionIncrease_f(), PR_ProductionList_f(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_ProductionStop_f(), PR_ProductionType_f(), PR_ProductionUp_f(), RS_Change_f(), RS_FillTechnologyList_f(), RS_Max_f(), RS_Stop_f(), TR_Add_f(), TR_Fill_f(), TR_Init_f(), TR_InitBaseList(), TR_SelectBase_f(), TR_TransferListClear_f(), and TR_TransferStart_f().
Get the first unfounded base.
Definition at line 1537 of file cp_base.cpp.
References B_GetBaseByIDX(), base_t::founded, and MAX_BASES.
Referenced by B_Build().
Array bound check for the base index.
| [in] | baseIdx | Index to check |
Definition at line 326 of file cp_base.cpp.
References B_GetBaseByIDX(), and B_GetCount().
Referenced by AC_Init_f(), AC_KillAll_f(), AC_KillExceeding_f(), AC_KillOne_f(), AC_LoadXML(), AIR_ShowAircraft_f(), B_AssembleMap_f(), B_BaseInit_f(), B_BuildingDestroy_f(), B_BuildingOpenAfterClick_f(), B_ChangeBaseName_f(), B_Destroy_AntimaterStorage_f(), B_FillMap_f(), B_SelectBase_f(), BDEF_RemoveBattery_f(), BS_Buy_f(), BS_FillMarket_f(), CL_PopupChangeHomebase_f(), E_GetCounts_f(), GAME_CP_DrawBaseLayoutTooltip(), HOS_Init_f(), PR_ShowActiveProduction_f(), RADAR_UpdateBaseRadarCoverage_f(), RS_ShowActiveResearch_f(), TR_DestinationCapacityList_f(), and TR_SelectBase_f().
Counts the actual installation count limit.
Definition at line 1153 of file cp_base.cpp.
References B_COMMAND, B_GetBuildingStatus(), B_GetNext(), and MAX_INSTALLATIONS_PER_BASE.
Referenced by INS_BuildInstallation_f(), INS_FillTypes_f(), INS_SelectType_f(), INS_UpdateInstallationLimit_f(), and TEST_F().
| float B_GetMaxBuildingLevel | ( | const base_t * | base, |
| const buildingType_t | type ) |
Get the maximum level of a building type in a base.
| [in] | base | Pointer to base. |
| [in] | type | Building type to get the maximum level for. |
Definition at line 519 of file cp_base.cpp.
References B_GetBuildingStatus(), B_GetNextBuildingByType(), B_STATUS_WORKING, building_t::buildingStatus, building_t::level, and type.
Referenced by B_Build(), B_LoadXML(), and RADAR_UpdateBaseRadarCoverage_f().
|
static |
Returns the neighbourhood of a building.
| [in] | building | The building we ask neighbours |
Definition at line 58 of file cp_base.cpp.
References B_GetBuildingAt, B_IsBuildingBuiltUp(), building_t::base, cgi, i, building_t::pos, and building_t::size.
Referenced by B_BuildBuilding(), and B_IsBuildingDestroyable().
Iterates through founded bases.
| [in] | lastBase | Pointer of the base to iterate from. call with nullptr to get the first one. |
Definition at line 286 of file cp_base.cpp.
References B_GetCount(), and ccs.
Referenced by AB_UpdateStealthForAllBase(), AII_RepairAircraft(), AII_UpdateInstallationDelay(), AIR_AircraftsNotifyUFORemoved(), AIRFIGHT_CampaignRunBaseDefence(), AL_CountAll(), B_GetCurrentSelectedBase(), B_GetInstallationLimit(), B_MoveAircraftOnGeoscapeToOtherBases(), B_PostLoadInitCapacity(), B_SaveXML(), B_SetCurrentSelectedBase(), B_UpdateBuildingConstructions(), BDEF_AutoSelectTarget(), CAP_CheckOverflow(), CL_DisplayHomebasePopup(), CL_DisplayPopupInterceptUFO(), CL_PopupInterceptBaseClick_f(), CP_BaseAttackChooseBase(), CP_ResetCampaignData(), GEO_Click(), GEO_DrawMarkers(), GEO_GetGeoscapeAngle(), GEO_PositionCloseToBase(), NAT_HandleBudget(), PR_PostLoadInitProgress(), PR_ProductionBase(), PR_ProductionRun(), PR_SaveXML(), RADAR_AddDetectedUFOToEveryRadar(), RADAR_CheckRadarSensored(), RADAR_DeactivateRadarOverlay(), RADAR_NotifyUFORemoved(), RADAR_UpdateStaticRadarCoverage(), RS_MarkStoryLineEventResearched(), STAT_GetExpenses_f(), TR_Init_f(), TR_InitBaseList(), UFO_CampaignCheckEvents(), and UFO_UpdateAlienInterestForAllBasesAndInstallations().
| building_t * B_GetNextBuilding | ( | const base_t * | base, |
| building_t * | lastBuilding ) |
Iterates through buildings in a base.
| [in] | base | Pointer to the base which buildings asked |
| [in] | lastBuilding | Pointer to the building iterate from. Call with nullptr to get the first one. |
Definition at line 339 of file cp_base.cpp.
References B_GetBuildingByIDX, ccs, and base_t::idx.
Referenced by B_GetNextBuildingByType(), B_GetNumberOfBuildingsInBaseByTemplate(), B_IsBuildingDestroyable(), B_ResetAllStatusAndCapacities(), B_SaveXML(), B_UpdateBuildingConstructions(), B_UpdateStatusBuilding(), and CP_GetSalaryUpKeepBase().
| building_t * B_GetNextBuildingByType | ( | const base_t * | base, |
| building_t * | lastBuilding, | ||
| buildingType_t | buildingType ) |
Iterates throught buildings of a type in a base.
| [in] | base | Pointer to the base which buildings asked |
| [in] | lastBuilding | Pointer to the building iterate from. Call with nullptr to get the first one. |
| [in] | buildingType | Type of the buildings to search |
Definition at line 367 of file cp_base.cpp.
References B_GetNextBuilding(), and building_t::buildingType.
Referenced by B_CheckBuildingTypeStatus(), B_GetBuildingInBaseByType(), B_GetMaxBuildingLevel(), B_GetNumberOfBuildingsInBaseByBuildingType(), B_UpdateBaseCapacities(), and BDEF_RemoveBattery_f().
| int B_GetNumberOfBuildingsInBaseByBuildingType | ( | const base_t * | base, |
| const buildingType_t | buildingType ) |
Counts the number of buildings of a particular building type in a base.
| [in] | base | Which base to count in. |
| [in] | buildingType | Building type value. |
Definition at line 1386 of file cp_base.cpp.
References B_GetNextBuildingByType(), B_STATUS_NOT_SET, building_t::buildingStatus, cgi, and MAX_BUILDING_TYPE.
Referenced by B_BuildingDestroy(), and CP_BaseAttackStartMission().
| int B_GetNumberOfBuildingsInBaseByTemplate | ( | const base_t * | base, |
| const building_t * | tpl ) |
Counts the number of buildings of a particular type in a base.
| [in] | base | Which base to count in. |
| [in] | tpl | The template type in the ccs.buildingTemplates list. |
Definition at line 1353 of file cp_base.cpp.
References B_GetNextBuilding(), B_STATUS_NOT_SET, building_t::buildingStatus, cgi, and building_t::tpl.
Referenced by B_FillBuildingInfo_f(), and B_ListBuildings_f().
|
static |
Prepares initial equipment for initial team the beginning of the campaign.
| [in,out] | aircraft | aircraft on which the soldiers (to equip) are |
| [in] | ed | Initial equipment definition |
Definition at line 1759 of file cp_base.cpp.
References aircraft_t::acTeam, AIR_MoveEmployeeInventoryIntoStorage(), CAP_UpdateStorageCap(), cgi, CL_SwapSkills(), DEBUG_CLIENT, aircraft_t::homebase, LIST_Foreach, character_t::name, and base_t::storage.
Referenced by B_SetUpFirstBase().
Resets console commands.
Definition at line 1970 of file cp_base.cpp.
References cgi.
Referenced by CP_InitStartup().
| bool B_IsBuildingDestroyable | ( | const building_t * | building | ) |
Returns if a base building is destroyable.
| [in] | building | Pointer to the building to check |
Definition at line 224 of file cp_base.cpp.
References B_GetNeighbours(), B_GetNextBuilding(), building_t::base, BASE_DESTROYED, base_t::baseStatus, ccs, cgi, linkedList_t::data, i, base_t::idx, building_t::idx, LIST_Foreach, MAX_BUILDINGS, and OBJZERO.
Referenced by B_BuildingDestroy(), and B_BuildingDestroy_f().
Check if the item has been collected (i.e it is in the storage) in the given base.
| [in] | item | The item to check |
| [in] | base | The base to search in. |
Definition at line 2133 of file cp_base.cpp.
References objDef_t::idx, objDef_t::isVirtual, equipDef_t::numItems, and base_t::storage.
Referenced by AIM_UpdateAircraftItemList(), AIR_Refuel(), B_AddToStorage(), B_AntimatterInBase(), B_BaseHasItem(), B_UpdateAntimatterCap(), BS_Buy_f(), BS_FillMarket_f(), BS_SellItem(), CAP_UpdateStorageCap(), PR_RequirementsInfo(), PR_RequirementsMet(), PR_UpdateProductionList(), RS_RequirementsMet(), TR_Add_f(), and TR_FillItems().
| bool B_ItemIsStoredInBaseStorage | ( | const objDef_t * | obj | ) |
Check if an item is stored in storage.
| [in] | obj | Pointer to the item to check. |
Definition at line 2560 of file cp_base.cpp.
References ANTIMATTER_ITEM_ID, objDef_t::id, objDef_t::isVirtual, and Q_streq.
Referenced by B_AddToStorage(), CAP_UpdateStorageCap(), CP_ItemsSanityCheck(), TR_Add_f(), TR_EmptyTransferCargo(), TR_FillItems(), and TR_TransferStart().
| int B_LoadBaseSlotsXML | ( | baseWeapon_t * | weapons, |
| int | max, | ||
| xmlNode_t * | p ) |
Loads the missile and laser slots of a base or sam site.
| [out] | weapons | Defence weapons array |
| [out] | max | Number of entries in weapons array |
| [in] | p | XML Node structure, where we load the information from |
Definition at line 2347 of file cp_base.cpp.
References AII_LoadOneSlotXML(), baseWeapon_t::autofire, cgi, i, SAVE_BASES_AUTOFIRE, SAVE_BASES_TARGET, SAVE_BASES_WEAPON, baseWeapon_t::target, UFO_GetByIDX(), XML_GetNextNode(), and xmlNode_t.
Referenced by B_LoadXML(), and INS_LoadXML().
| bool B_LoadStorageXML | ( | xmlNode_t * | parent, |
| equipDef_t * | equip ) |
Loads base storage.
| [in] | parent | XML Node structure, where we get the information from |
| [out] | equip | Storage to load |
Definition at line 2387 of file cp_base.cpp.
References cgi, objDef_t::idx, INVSH_GetItemByID(), equipDef_t::numItems, equipDef_t::numItemsLoose, SAVE_BASES_ITEM, SAVE_BASES_NUM, SAVE_BASES_NUMLOOSE, SAVE_BASES_ODS_ID, and xmlNode_t.
Referenced by B_LoadXML().
| bool B_LoadXML | ( | xmlNode_t * | parent | ) |
Loads base data.
| [in] | parent | XML Node structure, where we get the information from |
Definition at line 2406 of file cp_base.cpp.
References base_t::aircraftCurrent, base_t::alienContainment, base_t::alienInterest, B_GetBaseByIDX(), B_GetBuildingByIDX, B_GetBuildingIDX, B_GetBuildingTemplate(), B_GetCount(), B_GetMaxBuildingLevel(), B_LoadBaseSlotsXML(), B_LoadStorageXML(), B_RADAR, building_t::base, base_t::baseStatus, base_t::batteries, BDEF_InitialiseBaseSlots(), base_t::bEquipment, baseBuildingTile_t::blocked, baseBuildingTile_t::building, building_t::buildingStatus, building_t::buildTime, CAP_ALIENS, CAP_Get, ccs, cgi, FOREACH_XMLNODE, base_t::founded, i, base_t::idx, building_t::idx, Inventory::init(), base_t::lasers, building_t::level, AlienCargo::load(), base_t::map, MAX_BASE_SLOT, MAX_BUILDINGS, MAX_VAR, base_t::name, base_t::numBatteries, base_t::numLasers, base_t::pos, building_t::pos, baseBuildingTile_t::posX, baseBuildingTile_t::posY, Q_strncpyz(), base_t::radar, RADAR_Initialise(), RADAR_InitialiseUFOs(), SAVE_BASES_ALIENCONTAINMENT, SAVE_BASES_ALIENINTEREST, SAVE_BASES_BASE, SAVE_BASES_BASESTATUS, SAVE_BASES_BATTERIES, SAVE_BASES_BLOCKED, SAVE_BASES_BUILDING, SAVE_BASES_BUILDING_PLACE, SAVE_BASES_BUILDINGBUILDTIME, SAVE_BASES_BUILDINGINDEX, SAVE_BASES_BUILDINGLEVEL, SAVE_BASES_BUILDINGS, SAVE_BASES_BUILDINGSPACE, SAVE_BASES_BUILDINGSTATUS, SAVE_BASES_BUILDINGTIMESTART, SAVE_BASES_BUILDINGTYPE, SAVE_BASES_IDX, SAVE_BASES_LASERS, SAVE_BASES_NAME, SAVE_BASES_POS, SAVE_BASES_RADARRANGE, SAVE_BASES_STORAGE, SAVE_BASES_TRACKINGRANGE, SAVE_BASES_X, SAVE_BASES_Y, SAVE_BASESTATUS_NAMESPACE, SAVE_BUILDINGSTATUS_NAMESPACE, saveBaseConstants, base_t::storage, building_t::timeStart, and xmlNode_t.
Referenced by SAV_Init().
Check a base cell.
Definition at line 1263 of file cp_base.cpp.
References B_GetBuildingAt, B_IsTileBlocked, and BASE_SIZE.
Will ensure that aircraft on geoscape are not stored in a base that no longer has any hangar left.
| [in] | base | The base that is going to be destroyed |
Definition at line 861 of file cp_base.cpp.
References AIR_CheckMoveIntoNewHomebase(), AIR_DestroyAircraft(), AIR_ForeachFromBase, AIR_IsAircraftOnGeoscape(), AIR_MoveAircraftIntoNewHomebase(), B_GetNext(), CP_SpawnRescueMission(), GEO_GetColor(), MapIsWater, MAPTYPE_TERRAIN, and UFO_NotifyPhalanxAircraftRemoved().
Referenced by B_Destroy().
| void B_ParseBaseTemplate | ( | const char * | name, |
| const char ** | text ) |
Reads a base layout template.
| [in] | name | The script id of the base template |
| [in] | text | The script block to parse |
Definition at line 1435 of file cp_base.cpp.
References BASE_SIZE, baseBuildingTile_t::building, baseTemplate_t::buildings, ccs, cgi, Com_Parse(), cp_campaignPool, linkedList_t::data, ERR_DROP, i, baseTemplate_t::id, building_t::id, building_t::mandatory, MAX_BASEBUILDINGS, MAX_BASETEMPLATES, MAX_BUILDINGS, building_t::maxCount, name, linkedList_t::next, baseTemplate_t::numBuildings, OBJZERO, baseBuildingTile_t::posX, baseBuildingTile_t::posY, Q_streq, and V_POS.
Referenced by CP_ParseScriptSecond().
| bool B_PostLoadInit | ( | void | ) |
Set the capacity stuff for all the bases after loading a savegame.
Definition at line 2377 of file cp_base.cpp.
References B_PostLoadInitCapacity().
Referenced by SAV_GameActionsAfterLoad().
|
static |
Set the capacity stuff for all the bases after loading a savegame.
Definition at line 2364 of file cp_base.cpp.
References B_GetNext(), and B_ResetAllStatusAndCapacities().
Referenced by B_PostLoadInit().
Recalculate status and capacities of one base.
| [in] | base | Pointer to the base where status and capacities must be recalculated |
| [in] | firstEnable | true if this is the first time the function is called for this base |
Definition at line 706 of file cp_base.cpp.
References B_CheckUpdateBuilding(), B_FireEvent(), B_GetBuildingStatus(), B_GetBuildingTypeByCapacity(), B_GetNextBuilding(), B_MISC, B_ONENABLE, B_SetBuildingStatus(), B_UpdateAntimatterCap(), B_UpdateBaseCapacities(), building_t::buildingType, CAP_ANTIMATTER, CAP_EMPLOYEES, CAP_GetFreeCapacity(), CAP_ITEMS, CAP_LABSPACE, CAP_SetCurrent(), CAP_UpdateStorageCap(), CAP_WORKSPACE, cgi, DEBUG_CLIENT, E_CountAllHired(), i, MAX_BUILDING_TYPE, MAX_CAP, base_t::name, PR_UpdateProductionCap(), RS_CountScientistsInBase(), and type.
Referenced by B_Build(), and B_PostLoadInitCapacity().
| void B_SaveBaseSlotsXML | ( | const baseWeapon_t * | weapons, |
| const int | numWeapons, | ||
| xmlNode_t * | node ) |
Saves the missile and laser slots of a base or sam site.
| [in] | weapons | Defence weapons array |
| [in] | numWeapons | Number of entries in weapons array |
| [out] | node | XML Node structure, where we write the information to |
Definition at line 2228 of file cp_base.cpp.
References AII_SaveOneSlotXML(), cgi, i, SAVE_BASES_AUTOFIRE, SAVE_BASES_TARGET, SAVE_BASES_WEAPON, and xmlNode_t.
Referenced by B_SaveXML(), and INS_SaveXML().
| bool B_SaveStorageXML | ( | xmlNode_t * | parent, |
| const equipDef_t & | equip ) |
Saves base storage.
| [out] | parent | XML Node structure, where we write the information to |
| [in] | equip | Storage to save |
Definition at line 2244 of file cp_base.cpp.
References cgi, objDef_t::id, INVSH_GetItemByIDX(), equipDef_t::numItems, equipDef_t::numItemsLoose, SAVE_BASES_ITEM, SAVE_BASES_NUM, SAVE_BASES_NUMLOOSE, SAVE_BASES_ODS_ID, and xmlNode_t.
Referenced by B_SaveXML().
| bool B_SaveXML | ( | xmlNode_t * | parent | ) |
Save callback for saving in xml format.
| [out] | parent | XML Node structure, where we write the information to |
Definition at line 2263 of file cp_base.cpp.
References base_t::alienContainment, base_t::alienInterest, B_GetBuildingAt, B_GetNext(), B_GetNextBuilding(), B_IsTileBlocked, B_SaveBaseSlotsXML(), B_SaveStorageXML(), BASE_SIZE, base_t::baseStatus, base_t::batteries, building_t::buildingStatus, building_t::buildTime, cgi, base_t::founded, DateTime::getDateAsDays(), DateTime::getTimeAsSeconds(), base_t::idx, building_t::idx, base_t::lasers, building_t::level, base_t::name, base_t::numBatteries, base_t::numLasers, base_t::pos, building_t::pos, base_t::radar, AlienCargo::save(), SAVE_BASES_ALIENCONTAINMENT, SAVE_BASES_ALIENINTEREST, SAVE_BASES_BASE, SAVE_BASES_BASES, SAVE_BASES_BASESTATUS, SAVE_BASES_BATTERIES, SAVE_BASES_BLOCKED, SAVE_BASES_BUILDING, SAVE_BASES_BUILDING_PLACE, SAVE_BASES_BUILDINGBUILDTIME, SAVE_BASES_BUILDINGINDEX, SAVE_BASES_BUILDINGLEVEL, SAVE_BASES_BUILDINGS, SAVE_BASES_BUILDINGSPACE, SAVE_BASES_BUILDINGSTATUS, SAVE_BASES_BUILDINGTIMESTART, SAVE_BASES_BUILDINGTYPE, SAVE_BASES_IDX, SAVE_BASES_LASERS, SAVE_BASES_NAME, SAVE_BASES_POS, SAVE_BASES_RADARRANGE, SAVE_BASES_STORAGE, SAVE_BASES_TRACKINGRANGE, SAVE_BASES_X, SAVE_BASES_Y, SAVE_BASESTATUS_NAMESPACE, SAVE_BUILDINGSTATUS_NAMESPACE, saveBaseConstants, base_t::storage, building_t::timeStart, building_t::tpl, and xmlNode_t.
Referenced by SAV_Init().
Select and opens a base.
| [in] | base | If this is nullptr we want to build a new base |
Definition at line 1592 of file cp_base.cpp.
References B_GetCount(), B_SetCurrentSelectedBase(), ccs, cgi, DEBUG_CLIENT, GEO_IsRadarOverlayActivated(), GEO_ResetAction(), GEO_SetOverlay(), base_t::idx, MA_NEWBASE, MA_NONE, and MAX_BASES.
Referenced by B_BuildBase_f(), B_SelectBase_f(), CL_PopupInterceptRClick_f(), and CP_CampaignInit().
|
static |
Sell items to the market or add them to base storage.
| [in] | aircraft | Pointer to an aircraft landing in base. |
Definition at line 2030 of file cp_base.cpp.
References _, B_AddToStorage(), BS_GetItemSellingPrice(), BS_SellItem(), CAP_UpdateStorageCap(), ccs, cgi, Com_sprintf(), cp_messageBuffer, ItemCargo::empty(), aircraft_t::homebase, aircraft_t::itemCargo, lengthof, ItemCargo::list(), LIST_Foreach, MS_AddNewMessage(), ngettext, RS_GetTechForItem(), RS_IsResearched_ptr(), RS_MarkCollected(), RS_MarkResearchable(), and va().
Referenced by B_DumpAircraftToHomeBase().
| void B_SetBuildingStatus | ( | base_t *const | base, |
| const buildingType_t | buildingType, | ||
| bool | newStatus ) |
Set status associated to a building.
| [in] | base | Base to check |
| [in] | buildingType | value of building->buildingType |
| [in] | newStatus | New value of the status |
Definition at line 499 of file cp_base.cpp.
References B_MISC, cgi, DEBUG_CLIENT, base_t::hasBuilding, and MAX_BUILDING_TYPE.
Referenced by B_BuildingDestroy(), B_CheckUpdateBuilding(), and B_ResetAllStatusAndCapacities().
Sets the selected base.
| [in] | base | The base that is going to be selected |
Definition at line 1553 of file cp_base.cpp.
References AIR_GetFirstFromBase(), base_t::aircraftCurrent, B_GetNext(), base_t::baseStatus, cgi, INS_SetCurrentSelectedInstallation(), base_t::name, and base_t::selected.
Referenced by B_Build(), B_SelectBase(), CP_BaseAttackPrepareBattle(), and INS_SelectInstallation().
Set the base name.
| [out] | base | The base to set the name for |
| [in] | name | The name for the base. This might already be in utf-8 as it's the user input from the UI |
Definition at line 1173 of file cp_base.cpp.
References base_t::name, name, and Q_strncpyz().
Referenced by B_Build(), B_ChangeBaseName_f(), and TEST_F().
| void B_SetUpFirstBase | ( | const campaign_t * | campaign, |
| base_t * | base ) |
Setup aircraft and equipment for first base. Uses the campaign scriptable equipmentlist.
| [in] | campaign | The campaign data structure |
| [in,out] | base | The base to set up |
Definition at line 1107 of file cp_base.cpp.
References AIM_AutoEquipAircraft(), AIR_AssignInitial(), AIR_GetAircraft(), AIR_GetHangarCapacityType(), AIR_NewAircraft(), AIR_STATS_FUELSIZE, B_InitialEquipment(), CAP_AIRCRAFT_BIG, CAP_AIRCRAFT_SMALL, CAP_GetFreeCapacity(), ccs, cgi, CP_UpdateCredits(), E_HireEmployeeByType(), EMPL_PILOT, campaign_t::equipment, ERR_DROP, aircraft_t::fuel, aircraft_t::id, campaign_t::initialCraft, LIST_Foreach, MAX_CAP, aircraft_t::price, campaign_t::soldierEquipment, aircraft_t::stats, and base_t::storage.
Referenced by B_BuildBase_f(), CreateBase(), and TEST_F().
|
static |
Updates base status for particular buildings as well as capacities.
| [in,out] | building | Pointer to building. |
| [in] | status | Enum of buildingStatus_t which is status of given building. |
Definition at line 979 of file cp_base.cpp.
References B_CheckUpdateBuilding(), B_FireEvent(), B_GetCapacityFromBuildingType(), B_ONENABLE, B_UpdateBaseCapacities(), B_UpdateStatusBuilding(), building_t::base, building_t::buildingStatus, building_t::buildingType, and MAX_CAP.
Referenced by B_AddBuildingToBasePos(), and B_CheckBuildingConstruction().
Update Antimatter Capacity.
| [in] | base | Pointer to the base |
Definition at line 694 of file cp_base.cpp.
References ANTIMATTER_ITEM_ID, B_ItemInBase(), CAP_ANTIMATTER, CAP_SetCurrent(), and INVSH_GetItemByID().
Referenced by B_ResetAllStatusAndCapacities().
| void B_UpdateBaseCapacities | ( | baseCapacities_t | cap, |
| base_t * | base ) |
Updates base capacities.
| [in] | cap | Enum type of baseCapacities_t. |
| [in] | base | Pointer to the base. |
< Update Aliens capacity in base.
< Update employees capacity in base.
< Update laboratory space capacity in base.
< Update workshop space capacity in base.
< Update items capacity in base.
< Update aircraft capacity in base.
< Update aircraft capacity in base.
< Update antimatter capacity in base.
< Update all capacities in base.
Definition at line 2160 of file cp_base.cpp.
References base_t::alienContainment, B_GetBuildingTypeByCapacity(), B_GetNextBuildingByType(), B_STATUS_CONSTRUCTION_FINISHED, B_UpdateBaseCapacities(), building_t::buildingStatus, building_t::buildingType, CAP_AddMax(), CAP_AIRCRAFT_BIG, CAP_AIRCRAFT_SMALL, CAP_ALIENS, CAP_ANTIMATTER, CAP_EMPLOYEES, CAP_Get, CAP_GetMax, CAP_ITEMS, CAP_LABSPACE, CAP_SetMax(), CAP_WORKSPACE, building_t::capacity, ccs, cgi, capacities_t::cur, DEBUG_CLIENT, ERR_DROP, i, building_t::id, capacities_t::max, and MAX_CAP.
Referenced by B_BuildingDestroy(), B_ResetAllStatusAndCapacities(), B_UpdateAllBaseBuildingStatus(), and B_UpdateBaseCapacities().
Updates base data.
Definition at line 2009 of file cp_base.cpp.
References _, B_CheckBuildingConstruction(), B_GetNext(), B_GetNextBuilding(), Com_sprintf(), cp_messageBuffer, lengthof, MSO_CheckAddNewMessage(), base_t::name, building_t::name, and NT_BUILDING_FINISHED.
Referenced by CP_CampaignRun(), and TEST_F().
|
static |
Update status of every building when a building has been built/destroyed.
| [in] | base | |
| [in] | buildingType | The building-type that has been built / removed. |
| [in] | onBuilt | true if building has been built, false else |
Definition at line 635 of file cp_base.cpp.
References B_CheckUpdateBuilding(), B_FireEvent(), B_GetBuildingStatus(), B_GetNextBuilding(), B_ONDISABLE, B_ONENABLE, building_t::buildingType, and building_t::dependsBuilding.
Referenced by B_BuildingDestroy(), and B_UpdateAllBaseBuildingStatus().
|
static |
Definition at line 1641 of file cp_base.cpp.
References ABILITY_ACCURACY, ABILITY_MIND, ABILITY_POWER, ABILITY_SPEED, cgi, CL_SwapSkill(), ERR_DROP, character_t::score, SKILL_ASSAULT, SKILL_CLOSE, SKILL_EXPLOSIVE, SKILL_HEAVY, SKILL_SNIPER, and chrScoreGlobal_t::skills.
Referenced by CL_SwapSkills().
|
static |
Assembles a skill indicator for the given character and its wore weapons in correlation to the given skill.
| [in] | chr | The character to get the skill indicator for |
| [in] | skill | The skill to get the indicator for |
This currently always uses exactly the first two firemodes (see fmode1+fmode2) for calculation. This needs to be adapted to support less (1) or more 3+ firemodes. I think the function will even break on only one firemode .. never tested it.
i think currently also the different ammo/firedef types for each weapon (different weaponr_fd_idx and weaponr_fd_idx values) are ignored.
Definition at line 1682 of file cp_base.cpp.
References Item::ammoDef(), Item::def(), objDef_t::fd, Item::getFiredefs(), Inventory::getHolsterContainer(), Inventory::getRightHandContainer(), character_t::inv, Item::isReloadable(), fireDef_t::weapFdsIdx, and fireDef_t::weaponSkill.
Referenced by CL_SwapSkills().
|
static |
Swaps one skill from character1 to character 2 and vice versa.
Definition at line 1622 of file cp_base.cpp.
References chrScoreGlobal_t::experience, chrScoreGlobal_t::initialSkills, character_t::score, and chrScoreGlobal_t::skills.
Referenced by CL_DoSwapSkills().
|
static |
Swaps skills of the initial team of soldiers so that they match inventories.
Definition at line 1719 of file cp_base.cpp.
References ABILITY_NUM_TYPES, cgi, CL_DoSwapSkills(), CL_GetSkillIndicator(), i, LIST_Foreach, and SKILL_NUM_TYPES.
Referenced by B_InitialEquipment().