Handles everything that is located in or accessed trough a base. More...
#include "../client.h"
#include "../cl_inventory.h"
#include "../ui/ui_main.h"
#include "../ui/ui_popup.h"
#include "../../shared/parse.h"
#include "cp_campaign.h"
#include "cp_mapfightequip.h"
#include "cp_aircraft.h"
#include "cp_missions.h"
#include "cp_map.h"
#include "cp_popup.h"
#include "cp_time.h"
#include "cp_base_callbacks.h"
#include "cp_ufo.h"
#include "save/save_base.h"
Go to the source code of this file.
Defines | |
#define | MAX_BUILDING_INFO_TEXT_LENGTH 512 |
Functions | |
static void | B_PackInitialEquipment (aircraft_t *aircraft, const equipDef_t *ed) |
Assigns initial soldier equipment for the first base. | |
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. | |
qboolean | 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. | |
qboolean | 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, qboolean newStatus) |
Set status associated to a building. | |
qboolean | B_CheckBuildingDependencesStatus (const base_t *const base, const building_t *building) |
Check that the dependences of a building is operationnal. | |
void | B_ResetBuildingCurrent (base_t *base) |
Resets the buildingCurrent variable and baseAction. | |
float | B_GetMaxBuildingLevel (const base_t *base, const buildingType_t type) |
Get the maximum level of a building type in a base. | |
qboolean | B_AssembleMap (const base_t *base) |
Perform the base assembling in case of an alien attack. | |
static qboolean | B_CheckUpdateBuilding (building_t *building, base_t *base) |
Check base status for particular buildings as well as capacities. | |
static void | B_UpdateOneBaseBuildingStatusOnEnable (buildingType_t type, base_t *base) |
Actions to perform when a type of buildings goes from qfalse to qtrue. | |
static void | B_UpdateOneBaseBuildingStatusOnDisable (buildingType_t type, base_t *base) |
Actions to perform when a type of buildings goes from functional to non-functional. | |
static qboolean | B_UpdateStatusBuilding (base_t *base, buildingType_t buildingType, qboolean onBuilt) |
Update status of every building when a building has been built/destroyed. | |
static void | B_UpdateAntimatterCap (base_t *base) |
Update Antimatter Capacity. | |
int | B_FreeCapacity (const base_t *base, baseCapacities_t cap) |
Returns the free capacity of a type. | |
void | B_ResetAllStatusAndCapacities (base_t *base, qboolean firstEnable) |
Recalculate status and capacities of one base. | |
void | B_RemoveAircraftExceedingCapacity (base_t *base, buildingType_t buildingType) |
Actions to perform when destroying one hangar. | |
qboolean | B_BuildingDestroy (base_t *base, 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_Destroy (base_t *base) |
Destroy a base. | |
void | B_MarkBuildingDestroy (base_t *base, building_t *building) |
Mark a building for destruction - you only have to confirm it now. | |
void | B_BuildingStatus (const base_t *base, const building_t *building) |
Displays the status of a building for baseview. | |
static void | B_UpdateAllBaseBuildingStatus (building_t *building, base_t *base, buildingStatus_t status) |
Updates base status for particular buildings as well as capacities. | |
static void | B_AddBuildingToBasePos (base_t *base, const building_t const *buildingTemplate, qboolean hire, const vec2_t pos) |
Build starting building in the first base, and hire employees. | |
static void | B_InitialEquipment (base_t *base, aircraft_t *assignInitialAircraft, const char *eqname, equipDef_t *edTarget) |
Prepares initial equipment for first base at the beginning of the campaign. | |
static void | B_BuildFromTemplate (base_t *base, const char *templateName, qboolean hire) |
builds a base from template | |
static void | B_SetUpFirstBase (base_t *base) |
Setup buildings and equipment for first base. Uses the campaign scriptable first base template to place the buildings in the base. | |
int | B_GetInstallationLimit (void) |
Counts the actual installation count limit. | |
void | B_UpdateBaseCount (void) |
Update menu script related cvars when the amount of bases changed. | |
void | B_SetUpBase (base_t *base, vec2_t pos) |
Setup new base, uses template for the first base. | |
building_t * | B_GetBuildingTemplate (const char *buildingName) |
Returns the building in the global building-types list that has the unique name buildingID. | |
const baseTemplate_t * | B_GetBaseTemplate (const char *baseTemplateID) |
Returns the baseTemplate in the global baseTemplate list that has the unique name baseTemplateID. | |
static qboolean | B_CheckCredits (int costs) |
Checks whether you have enough credits to build this building. | |
static qboolean | B_ConstructBuilding (base_t *base, building_t *building) |
Builds new building. And checks whether the player has enough credits to construct the current selected building before starting construction. | |
static void | B_NewBuilding (base_t *base, building_t *building) |
Build new building. | |
building_t * | B_SetBuildingByClick (base_t *base, const building_t const *buildingTemplate, int row, int col) |
Set the currently selected building. | |
void | B_DrawBuilding (base_t *base, building_t *building) |
Draws a building. | |
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 buuilding type in a base. | |
buildingType_t | B_GetBuildingTypeByBuildingID (const char *buildingID) |
Returns the building type for a given building identified by its building id from the ufo script files. | |
void | B_ParseBuildings (const char *name, const char **text, qboolean link) |
Copies an entry from the building description file into the list of building types. | |
building_t * | B_GetBuildingInBaseByType (const base_t *base, buildingType_t buildingType, qboolean 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 lower IDX of unfounded base. | |
void | B_SetCurrentSelectedBase (const base_t *base) |
base_t * | B_GetCurrentSelectedBase (void) |
void | B_SelectBase (const base_t *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 int skill) |
static void | CL_SwapSkills (chrList_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_BuildingOpenAfterClick (const base_t *base, const building_t *building) |
Checks whether the building menu or the pedia entry should be called when you click a building in the baseview. | |
void | B_InitStartup (void) |
Resets console commands. | |
int | B_GetFoundedBaseCount (void) |
Counts the number of bases. | |
void | B_UpdateBaseData (void) |
Updates base data. | |
int | B_CheckBuildingConstruction (building_t *building, base_t *base) |
Checks whether the construction of a building is finished. Calls the onConstruct functions and assign workers, too. | |
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. | |
qboolean | 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, mxml_node_t *node) |
Saves the missile and laser slots of a base or sam site. | |
qboolean | B_SaveStorageXML (mxml_node_t *parent, const equipDef_t equip) |
Saves base storage. | |
qboolean | B_SaveXML (mxml_node_t *parent) |
Save callback for saving in xml format. | |
int | B_LoadBaseSlotsXML (baseWeapon_t *weapons, int max, mxml_node_t *p) |
Loads the missile and laser slots of a base or sam site. | |
static void | B_PostLoadInitCapacity (void) |
Set the capacity stuff for all the bases after loading a savegame. | |
void | B_PostLoadInit (void) |
Set the capacity stuff for all the bases after loading a savegame. | |
qboolean | B_LoadStorageXML (mxml_node_t *parent, equipDef_t *equip) |
Loads base storage. | |
qboolean | B_LoadXML (mxml_node_t *parent) |
Loads base data. | |
qboolean | 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. | |
qboolean | B_UpdateStorageAndCapacity (base_t *base, const objDef_t *obj, int amount, qboolean reset, qboolean ignorecap) |
Update the storage amount and the capacities for the storages in the base. | |
qboolean | B_ScriptSanityCheck (void) |
Checks the parsed buildings for errors. | |
void | B_RemoveItemsExceedingCapacity (base_t *base) |
Remove items until everything fits in storage. | |
void | B_UpdateStorageCap (base_t *base) |
Update Storage Capacity. | |
int | B_AntimatterInBase (const base_t *base) |
returns the amount of antimatter stored in a base | |
void | B_ManageAntimatter (base_t *base, int amount, qboolean add) |
Manages antimatter (adding, removing) through Antimatter Storage Facility. | |
void | B_RemoveAntimatterExceedingCapacity (base_t *base) |
Remove exceeding antimatter if an antimatter tank has been destroyed. | |
Variables | |
vec2_t | newBasePos |
static cvar_t * | cp_initial_equipment |
static const value_t | valid_building_vars [] |
Holds the names of valid entries in the basemanagement.ufo file. |
Handles everything that is located in or accessed trough a base.
Definition in file cp_base.c.
#define MAX_BUILDING_INFO_TEXT_LENGTH 512 |
Definition at line 1500 of file cp_base.c.
Referenced by B_DrawBuilding().
static void B_AddBuildingToBasePos | ( | base_t * | base, | |
const building_t const * | buildingTemplate, | |||
qboolean | hire, | |||
const vec2_t | pos | |||
) | [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 1053 of file cp_base.c.
References B_SetBuildingByClick(), B_STATUS_WORKING, B_UpdateAllBaseBuildingStatus(), Cmd_ExecuteString(), Com_DPrintf(), DEBUG_CLIENT, E_HireForBuilding(), building_s::id, base_s::idx, building_s::onConstruct, building_s::pos, and va().
Referenced by B_BuildFromTemplate().
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 3054 of file cp_base.c.
References B_ItemIsStoredInBaseStorage(), CAP_ITEMS, base_s::capacities, cap_maxcur_s::cur, objDef_s::idx, objDef_s::isVirtual, cap_maxcur_s::max, equipDef_s::numItems, objDef_s::size, and base_s::storage.
Referenced by PR_UpdateRequiredItemsInBasestorage().
void B_AircraftReturnedToHomeBase | ( | aircraft_t * | aircraft | ) |
Do anything when dropship returns to base.
[in] | aircraft | Returning aircraft. |
Definition at line 2601 of file cp_base.c.
References AII_ReloadAircraftWeapons(), B_DumpAircraftToHomeBase(), aircraft_s::radar, and RADAR_InitialiseUFOs().
Referenced by AIR_Move().
int B_AntimatterInBase | ( | const base_t * | base | ) |
returns the amount of antimatter stored in a base
[in] | base | Pointer to the base to check |
Definition at line 3260 of file cp_base.c.
References ANTIMATTER_TECH_ID, CAP_ANTIMATTER, base_s::capacities, Com_Error(), cap_maxcur_s::cur, ERR_DROP, objDef_s::idx, INVSH_GetItemByID(), equipDef_s::numItems, and base_s::storage.
Referenced by PR_RequirementsMet(), RS_RequirementsMet(), TR_TransferList_Scroll_f(), TR_TransferListSelect_f(), and TR_TransferSelect().
Perform the base assembling in case of an alien attack.
[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 349 of file cp_base.c.
References B_BuildingGetUsed, B_BuildingSetUsed, BASE_MAX_WORLDLEVEL, BASE_SIZE, BASE_TILE_UNITS, baseBuildingTile_s::building, Cbuf_AddText(), cl, Com_Error(), Com_Printf(), ERR_DROP, building_s::id, building_s::idx, base_s::map, MAP_IsNight(), building_s::mapPart, MAX_BUILDINGS, building_s::needs, base_s::pos, Q_strcat(), qfalse, qtrue, SAV_QuickSave(), and va().
Referenced by B_AssembleMap_f(), and CP_StartMissionMap().
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 2616 of file cp_base.c.
References objDef_s::idx, objDef_s::isVirtual, equipDef_s::numItems, and base_s::storage.
Referenced by AII_AddAmmoToSlot(), AII_AddItemToSlot(), AII_ReloadWeapon(), AIM_AutoEquipAircraft(), AIM_CheckTechnologyIntoSlot(), AIM_CrafttypeFilter(), and AIM_SelectableCraftItem().
void B_BaseResetStatus | ( | base_t *const | base | ) |
Sets the baseStatus to BASE_NOT_USED.
[in] | base | Which base should be reseted? |
Definition at line 2153 of file cp_base.c.
References BASE_NOT_USED, base_s::baseStatus, ccs, MA_BASEATTACK, MA_NONE, and ccs_s::mapAction.
static void B_BuildFromTemplate | ( | base_t * | base, | |
const char * | templateName, | |||
qboolean | hire | |||
) | [static] |
builds a base from template
[out] | base | The base to build |
[in] | templateName | Templated used for building. If NULL no template will be used. |
[in] | hire | If hiring employee needed |
Definition at line 1120 of file cp_base.c.
References B_AddBuildingToBasePos(), B_GetBaseTemplate(), B_GetBuildingStatus(), BASE_SIZE, stats_s::basesBuilt, baseBuildingTile_s::blocked, baseBuildingTile_s::building, baseTemplate_s::buildings, ccs_s::buildingTemplates, building_s::buildingType, ccs_s::campaignStats, base_s::capacities, ccs, Com_Error(), cap_maxcur_s::cur, ERR_DROP, frand(), i, building_s::mandatory, base_s::map, MAX_BLOCKEDFIELDS, MAX_CAP, MIN_BLOCKEDFIELDS, baseTemplate_s::numBuildings, ccs_s::numBuildingTemplates, pos, baseBuildingTile_s::posX, baseBuildingTile_s::posY, qtrue, and Vector2Set.
Referenced by B_SetUpBase(), and B_SetUpFirstBase().
qboolean B_BuildingDestroy | ( | base_t * | base, | |
building_t * | building | |||
) |
Removes a building from the given base.
[in] | base | Base to remove the building in |
[in] | building | The building to remove |
< Template of the removed building
Definition at line 715 of file cp_base.c.
References B_ENTRANCE, B_GetCapacityFromBuildingType(), B_GetNumberOfBuildingsInBaseByBuildingType(), B_MISC, B_SetBuildingStatus(), B_STATUS_NOT_SET, B_STATUS_WORKING, B_UpdateBaseCapacities(), B_UpdateStatusBuilding(), baseBuildingTile_s::building, base_s::buildingCurrent, ccs_s::buildings, building_s::buildingStatus, building_s::buildingType, ccs, Cmd_ExecuteString(), Com_DPrintf(), Com_Error(), DEBUG_CLIENT, ERR_DROP, i, building_s::idx, base_s::idx, int(), base_s::map, MAX_BUILDING_TYPE, MAX_CAP, building_s::needs, ccs_s::numBuildings, building_s::onDestroy, pos, building_s::pos, qfalse, qtrue, REMOVE_ELEM, building_s::tpl, and va().
Referenced by B_BuildingDestroy_f(), and B_Destroy().
void B_BuildingOpenAfterClick | ( | const base_t * | base, | |
const building_t * | building | |||
) |
Checks whether the building menu or the pedia entry should be called when you click a building in the baseview.
[in] | base | The current active base we are viewing right now |
[in] | building | The building we have clicked |
Definition at line 2250 of file cp_base.c.
References _, AC_ContainmentAllowed(), AIR_AircraftAllowed(), AIR_BaseHasAircraft(), B_ALIEN_CONTAINMENT, B_ANTIMATTER, B_DEFENCE_LASER, B_DEFENCE_MISSILE, B_GetBuildingStatus(), B_HANGAR, B_HOSPITAL, B_LAB, B_QUARTERS, B_SMALL_HANGAR, B_STORAGE, B_WORKSHOP, BS_BuySellAllowed(), building_s::buildingType, CAP_ANTIMATTER, base_s::capacities, ccs, Com_sprintf(), cap_maxcur_s::cur, E_HireAllowed(), HOS_HospitalAllowed(), cap_maxcur_s::max, ccs_s::numBases, building_s::pedia, popupText, PR_ProductionAllowed(), RS_ResearchAllowed(), UI_Popup(), UI_PushWindow(), and UP_OpenWith().
Referenced by UI_BaseMapNodeClick().
void B_BuildingStatus | ( | const base_t * | base, | |
const building_t * | building | |||
) |
Displays the status of a building for baseview.
Definition at line 961 of file cp_base.c.
References _, B_CheckBuildingDependencesStatus(), B_GetNumberOfBuildingsInBaseByTemplate(), B_STATUS_CONSTRUCTION_FINISHED, B_STATUS_DOWN, B_STATUS_NOT_SET, B_STATUS_UNDER_CONSTRUCTION, B_STATUS_WORKING, building_s::buildingStatus, Cvar_Set(), building_s::dependsBuilding, building_s::name, building_s::tpl, and va().
Referenced by B_BuildingStatus_f(), B_DrawBuilding(), and B_NewBuilding().
int B_CheckBuildingConstruction | ( | building_t * | building, | |
base_t * | base | |||
) |
Checks whether the construction of a building is finished. Calls the onConstruct functions and assign workers, too.
Definition at line 2471 of file cp_base.c.
References B_STATUS_UNDER_CONSTRUCTION, B_STATUS_WORKING, B_UpdateAllBaseBuildingStatus(), base_s::buildingCurrent, building_s::buildingStatus, building_s::buildTime, Cbuf_AddText(), ccs, Cmd_ExecuteString(), Com_DPrintf(), ccs_s::date, date_s::day, DEBUG_CLIENT, base_s::idx, building_s::onConstruct, building_s::timeStart, and va().
Referenced by B_UpdateBaseData().
qboolean B_CheckBuildingDependencesStatus | ( | const base_t *const | base, | |
const building_t * | building | |||
) |
Check that the dependences of a building is operationnal.
[in] | base | Base to check |
[in] | building | Pointer to the building to check |
Definition at line 263 of file cp_base.c.
References B_GetBuildingStatus(), building_s::buildingType, building_s::dependsBuilding, qtrue, and building_s::tpl.
Referenced by B_BuildingStatus(), B_CheckBuildingStatusForMenu_f(), B_CheckUpdateBuilding(), B_UpdateAllBaseBuildingStatus(), and UI_BaseMapNodeDrawTooltip().
qboolean 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 NULL if you are not interested in this value |
if (hasBuilding[B_QUARTERS])
check - this should speed things up a lot Definition at line 134 of file cp_base.c.
References B_GetNextBuildingByType(), building_s::buildingStatus, qfalse, and qtrue.
Referenced by B_CheckBuildingStatusForMenu_f().
static qboolean B_CheckCredits | ( | int | costs | ) | [inline, static] |
Checks whether you have enough credits to build this building.
costs | buildcosts of the building |
Definition at line 1359 of file cp_base.c.
References ccs, ccs_s::credits, qfalse, and qtrue.
Referenced by B_ConstructBuilding(), and B_SetBuildingByClick().
static qboolean B_CheckUpdateBuilding | ( | building_t * | building, | |
base_t * | base | |||
) | [static] |
Check base status for particular buildings as well as capacities.
[in] | building | Pointer to building. |
[in] | base | Pointer to base with given building. |
Definition at line 409 of file cp_base.c.
References B_CheckBuildingDependencesStatus(), B_GetBuildingStatus(), B_MISC, B_SetBuildingStatus(), B_STATUS_WORKING, building_s::buildingStatus, building_s::buildingType, Com_DPrintf(), DEBUG_CLIENT, building_s::name, qfalse, and qtrue.
Referenced by B_ResetAllStatusAndCapacities(), B_UpdateAllBaseBuildingStatus(), and B_UpdateStatusBuilding().
static qboolean B_ConstructBuilding | ( | base_t * | base, | |
building_t * | building | |||
) | [static] |
Builds new building. And checks whether the player has enough credits to construct the current selected building before starting construction.
[in,out] | base | The base to construct the building in |
[in,out] | building | The building to construct |
Definition at line 1377 of file cp_base.c.
References B_CheckCredits(), B_ResetBuildingCurrent(), B_STATUS_UNDER_CONSTRUCTION, building_s::buildingStatus, ccs, CL_UpdateCredits(), Cmd_ExecuteString(), Com_DPrintf(), ccs_s::credits, ccs_s::date, date_s::day, DEBUG_CLIENT, building_s::fixCosts, building_s::id, qfalse, qtrue, and building_s::timeStart.
Referenced by B_NewBuilding().
void B_Destroy | ( | base_t * | base | ) |
Destroy a base.
[in] | base | Pointer to base to be destroyed. |
Definition at line 831 of file cp_base.c.
References B_BuildingDestroy(), B_MoveAircraftOnGeoscapeToOtherBases(), BASE_DESTROYED, base_s::baseStatus, ccs_s::buildings, ccs, CP_MissionNotifyBaseDestroyed(), base_s::idx, and ccs_s::numBuildings.
Referenced by B_Destroy_AntimaterStorage_f(), and CP_BaseAttackMissionDestroyBase().
void B_DrawBuilding | ( | base_t * | base, | |
building_t * | building | |||
) |
Draws a building.
Definition at line 1505 of file cp_base.c.
References _, B_BuildingStatus(), B_STATUS_UNDER_CONSTRUCTION, building_s::buildingStatus, building_s::buildTime, Com_sprintf(), Cvar_Set(), building_s::dependsBuilding, building_s::fixCosts, building_s::image, MAX_BUILDING_INFO_TEXT_LENGTH, building_s::name, ngettext, Q_strcat(), TEXT_BUILDING_INFO, UI_RegisterText(), va(), and building_s::varCosts.
Referenced by B_BuildingClick_f(), B_BuildingInit(), and UI_BaseMapNodeMiddleClick().
void B_DumpAircraftToHomeBase | ( | aircraft_t * | aircraft | ) |
Will unload all cargo to the homebase.
[in,out] | aircraft | The aircraft to dump |
Definition at line 2575 of file cp_base.c.
References AIRCRAFT_TRANSPORTER, AL_AddAliens(), AL_GetAircraftAlienCargo, AL_SetAircraftAlienCargoTypes, B_SellOrAddItems(), aircraft_s::itemcargo, and aircraft_s::type.
Referenced by B_AircraftReturnedToHomeBase(), and CP_MissionEndActions().
int B_FreeCapacity | ( | const base_t * | base, | |
baseCapacities_t | cap | |||
) |
Returns the free capacity of a type.
[in] | base | Pointer to the base to check |
[in] | cap | Capacity type |
Definition at line 567 of file cp_base.c.
References base_s::capacities, cap_maxcur_s::cur, and cap_maxcur_s::max.
Referenced by TR_CheckItem(), and TR_TransferAliensFromMission_f().
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,.
[in] | baseIdx | Index to check |
Definition at line 54 of file cp_base.c.
References ccs_s::bases, ccs, and MAX_BASES.
Referenced by AC_LoadXML(), AIR_AircraftsUFODisappear(), AIR_LoadAircraftXML(), B_AssembleMap_f(), B_GetCurrentSelectedBase(), B_GetFirstUnfoundedBase(), B_GetFoundedBaseByIDX(), B_LoadXML(), B_MoveAircraftOnGeoscapeToOtherBases(), B_SaveXML(), B_SetCurrentSelectedBase(), BDEF_AddBattery_f(), CL_CampaignRunAircraft(), CL_ResetSinglePlayerData(), CP_AddItemAsCollected_f(), CP_LoadMissionsXML(), E_LoadXML(), PR_ProductionBase(), RS_LoadXML(), TR_LoadXML(), and UI_BaseLayoutNodeDraw().
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 1334 of file cp_base.c.
References ccs_s::baseTemplates, ccs, Com_Printf(), i, baseTemplate_s::id, and ccs_s::numBaseTemplates.
Referenced by B_BuildFromTemplate().
building_t* B_GetBuildingInBaseByType | ( | const base_t * | base, | |
buildingType_t | buildingType, | |||
qboolean | 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 1798 of file cp_base.c.
References B_GetBuildingStatus(), and B_GetNextBuildingByType().
Referenced by RS_AssignScientist(), and RS_InitGUIData().
qboolean 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 222 of file cp_base.c.
References B_MISC, Com_Printf(), base_s::hasBuilding, MAX_BUILDING_TYPE, qfalse, and qtrue.
Referenced by AC_AlienClick(), AC_ContainmentAllowed(), AC_KillOne_f(), AC_UpdateMenu(), AII_BaseCanShoot(), AIM_AircraftStart_f(), AIR_AircraftAllowed(), AIR_CanIntercept(), AIR_CheckMoveIntoNewHomebase(), AIR_UpdateHangarCapForOne(), AIRFIGHT_CampaignRunBaseDefence(), AL_AddAliens(), AL_ChangeAliveAlienNumber(), AL_CheckAliveFreeSpace(), AL_CountAll(), AL_CountForMenu(), B_BuildFromTemplate(), B_BuildingOpenAfterClick(), B_CheckBuildingDependencesStatus(), B_CheckUpdateBuilding(), B_GetBuildingInBaseByType(), B_GetInstallationLimit(), B_GetMaxBuildingLevel(), B_ManageAntimatter(), B_ResetAllStatusAndCapacities(), B_SetUpFirstBase(), B_UpdateStatusBuilding(), BaseSummary_Init(), BS_BuyAircraft_f(), BS_BuySellAllowed(), CL_PopupInterceptClick_f(), CL_ResearchType_f(), CP_BaseAttackChooseBase(), E_HireAllowed(), HOS_HospitalAllowed(), HOS_HospitalRun(), HOS_Init_f(), PR_ProductionAllowed(), PR_QueueNew(), RS_ResearchAllowed(), RS_ResearchStart_f(), RS_ResearchStop_f(), TR_CheckAircraft(), TR_CheckItem(), TR_EmptyTransferCargo(), TR_TransferBaseSelect(), TR_TransferList_Scroll_f(), TR_TransferListSelect_f(), TR_TransferSelect(), and UFO_CampaignCheckEvents().
building_t* B_GetBuildingTemplate | ( | const char * | buildingName | ) |
Returns the building in the global building-types list that has the unique name buildingID.
[in] | buildingName | The unique id of the building (building_t->id). |
Definition at line 1316 of file cp_base.c.
References ccs_s::buildingTemplates, ccs, Com_Printf(), i, building_s::id, and ccs_s::numBuildingTemplates.
Referenced by B_CheckBuildingStatusForMenu_f(), B_LoadXML(), B_ParseBuildings(), UI_BaseMapNodeDraw(), and UP_BuildingDescription().
buildingType_t B_GetBuildingTypeByBuildingID | ( | const char * | buildingID | ) |
Returns the building type for a given building identified by its building id from the ufo script files.
Definition at line 1616 of file cp_base.c.
References B_ALIEN_CONTAINMENT, B_ANTIMATTER, B_COMMAND, B_DEFENCE_LASER, B_DEFENCE_MISSILE, B_ENTRANCE, B_HANGAR, B_HOSPITAL, B_LAB, B_POWER, B_QUARTERS, B_RADAR, B_SMALL_HANGAR, B_STORAGE, B_WORKSHOP, and MAX_BUILDING_TYPE.
Referenced by B_ParseBuildings().
buildingType_t B_GetBuildingTypeByCapacity | ( | baseCapacities_t | cap | ) |
Get building type by base capacity.
[in] | cap | Enum type of baseCapacities_t. |
Definition at line 191 of file cp_base.c.
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(), and B_UpdateBaseCapacities().
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 160 of file cp_base.c.
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_CAP.
Referenced by B_BuildingDestroy(), B_MarkBuildingDestroy(), B_RemoveAircraftExceedingCapacity(), B_UpdateAllBaseBuildingStatus(), and BaseSummary_Init().
base_t* B_GetCurrentSelectedBase | ( | void | ) |
Definition at line 1953 of file cp_base.c.
References B_GetBaseByIDX(), i, MAX_BASES, and base_s::selected.
Referenced by AC_AlienClick_f(), 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_AircraftUpdateList_f(), AIR_ChangeAircraftName_f(), B_AssembleMap_f(), B_BaseInit_f(), B_BuildingClick_f(), B_BuildingDestroy_f(), B_BuildingInfoClick_f(), B_BuildingInit_f(), B_BuildingStatus_f(), B_ChangeBaseName_f(), B_CheckBuildingStatusForMenu_f(), B_NextBase_f(), B_PrevBase_f(), B_ResetBuildingCurrent_f(), BaseSummary_SelectBase_f(), BDEF_AddItem_f(), BDEF_BaseDefenceMenuUpdate_f(), BDEF_ChangeAutoFire(), BDEF_RemoveItem_f(), BDEF_SelectItem_f(), BS_Autosell_f(), BS_BuyAircraft_f(), BS_BuyItem_f(), BS_BuyType_f(), BS_MarketScroll_f(), BS_SellAircraft_f(), BS_SellItem_f(), CL_ActorPilotSelect_f(), CL_ActorTeamSelect_f(), CL_AssignPilot_f(), CL_AssignSoldier_f(), CL_ResearchSelect_f(), CL_ResearchType_f(), CL_UpdateEmployeeList(), CL_UpdateEquipmentMenuParameters_f(), E_EmployeeHire_f(), E_EmployeeList_f(), E_EmployeeListScroll_f(), E_EmployeeSelect(), E_UpdateGUICount_f(), HOS_Init_f(), HOS_ListClick_f(), HOS_UpdateMenu(), PR_ProductionDecrease_f(), PR_ProductionDown_f(), PR_ProductionIncrease_f(), PR_ProductionList_f(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_ProductionRollBottom_f(), PR_ProductionStop_f(), PR_ProductionType_f(), PR_ProductionUp_f(), RS_AssignScientist_f(), RS_ChangeScientist_f(), RS_RemoveScientist_f(), RS_ResearchStart_f(), RS_ResearchStop_f(), RS_UpdateData_f(), TR_CargoListSelect_f(), TR_Init_f(), TR_InitBaseList(), TR_SelectBase_f(), TR_TransferClose_f(), TR_TransferList_Scroll_f(), TR_TransferListClear_f(), TR_TransferListSelect_f(), TR_TransferSelect_f(), TR_TransferStart_f(), UI_BaseMapNodeClick(), UI_BaseMapNodeDraw(), UI_BaseMapNodeDrawTooltip(), UI_BaseMapNodeMiddleClick(), UI_BaseMapNodeRightClick(), and UI_ResearchInit_f().
base_t* B_GetFirstUnfoundedBase | ( | void | ) |
Get the lower IDX of unfounded base.
Definition at line 1910 of file cp_base.c.
References B_GetBaseByIDX(), base_s::founded, and MAX_BASES.
Referenced by B_BuildBase_f().
base_t* B_GetFoundedBaseByIDX | ( | int | baseIdx | ) |
Array bound check for the base index.
[in] | baseIdx | Index to check |
Definition at line 67 of file cp_base.c.
References B_GetBaseByIDX(), and base_s::founded.
Referenced by AB_UpdateStealthForAllBase(), AC_LoadXML(), AC_SaveXML(), AII_RepairAircraft(), AII_UpdateInstallationDelay(), AIR_AircraftGetFromIDX(), AIR_AircraftsNotifyMissionRemoved(), AIR_AircraftsNotifyUFORemoved(), AIR_IsEmployeeInAircraft(), AIR_PostLoadInitMissions(), AIR_RemoveEmployee(), AIR_SaveXML(), AIRFIGHT_CampaignRunBaseDefence(), AL_CountAll(), AL_CountForMenu(), B_BuildingOnDestroy_f(), B_Destroy_AntimaterStorage_f(), B_GetInstallationLimit(), B_NextBase_f(), B_PostLoadInitCapacity(), B_PrevBase_f(), B_SelectBase_f(), B_UpdateBaseData(), BaseSummary_SelectBase_f(), BDEF_AutoSelectTarget(), BDEF_RemoveBattery_f(), CL_DisplayHomebasePopup(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), CL_PopupChangeHomebase_f(), CL_PopupInterceptBaseClick_f(), CL_StatsUpdate_f(), CP_BaseAttackChooseBase(), CP_CheckBaseAttacks_f(), CP_NationHandleBudget(), E_DeleteEmployee(), MAP_DrawMapMarkers(), MAP_GetGeoscapeAngle(), MAP_MapClick(), MAP_MultiSelectExecuteAction_f(), MAP_PositionCloseToBase(), PR_ProductionQueueBase(), PR_ProductionRun(), RADAR_AddDetectedUFOToEveryRadar(), RADAR_CheckRadarSensored(), RADAR_DeactivateRadarOverlay(), RADAR_NotifyUFORemoved(), RADAR_UpdateBaseRadarCoverage_f(), RADAR_UpdateStaticRadarCoverage(), RADAR_UpdateWholeRadarOverlay(), RS_InitGUI(), RS_InitGUIData(), RS_InitTree(), RS_MarkStoryLineEventResearched(), TR_Init_f(), TR_InitBaseList(), TR_SelectBase_f(), TR_TransferAlienAfterMissionStart(), TR_TransferAliensFromMission_f(), TR_TransferBaseListClick_f(), UFO_CampaignCheckEvents(), UFO_SearchAircraftTarget(), and UFO_UpdateAlienInterestForAllBasesAndInstallations().
int B_GetFoundedBaseCount | ( | void | ) |
Counts the number of bases.
Definition at line 2428 of file cp_base.c.
References ccs_s::bases, ccs, and base_s::founded.
Referenced by B_LoadXML().
int B_GetInstallationLimit | ( | void | ) |
Counts the actual installation count limit.
Definition at line 1252 of file cp_base.c.
References B_COMMAND, B_GetBuildingStatus(), B_GetFoundedBaseByIDX(), ccs, i, MAX_INSTALLATIONS, MAX_INSTALLTAIONS_PER_BASE, and ccs_s::numBases.
Referenced by INS_BuildInstallation_f(), INS_GetFirstUnfoundedInstallation(), INS_SelectInstallation(), and INS_UpdateInsatallationLimit_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 327 of file cp_base.c.
References B_GetBuildingStatus(), B_GetNextBuildingByType(), B_STATUS_WORKING, building_s::buildingStatus, and building_s::level.
Referenced by B_LoadXML(), and RADAR_UpdateBaseRadarCoverage_f().
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 NULL to get the first one. |
Definition at line 82 of file cp_base.c.
References ccs_s::buildings, ccs, base_s::idx, and ccs_s::numBuildings.
Referenced by B_GetNextBuildingByType(), B_GetNumberOfBuildingsInBaseByTemplate(), B_ResetAllStatusAndCapacities(), B_SaveXML(), B_UpdateBaseData(), 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 NULL to get the first one. |
[in] | buildingType | Type of the buildings to search |
Definition at line 111 of file cp_base.c.
References B_GetNextBuilding(), and building_s::buildingType.
Referenced by B_CheckBuildingStatusForMenu_f(), 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 buuilding type in a base.
[in] | base | Which base to count in. |
[in] | buildingType | Building type value. |
Definition at line 1587 of file cp_base.c.
References B_GetNextBuildingByType(), B_STATUS_NOT_SET, building_s::buildingStatus, Com_Printf(), and MAX_BUILDING_TYPE.
Referenced by B_BuildingDestroy(), B_CheckBuildingStatusForMenu_f(), BaseSummary_Init(), CP_BaseAttackStartMission(), PR_ProductionList_f(), and PR_QueueFreeSpace().
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 1551 of file cp_base.c.
References B_GetNextBuilding(), B_STATUS_NOT_SET, building_s::buildingStatus, Com_Printf(), and building_s::tpl.
Referenced by B_BuildingInit(), and B_BuildingStatus().
static void B_InitialEquipment | ( | base_t * | base, | |
aircraft_t * | assignInitialAircraft, | |||
const char * | eqname, | |||
equipDef_t * | edTarget | |||
) | [static] |
Prepares initial equipment for first base at the beginning of the campaign.
[in] | base | Pointer to first base. |
[in] | assignInitialAircraft | aircraft on which the soldiers (to equip) are |
[in] | eqname | Initial equipment definition id |
[in] | edTarget | storage to put items to |
Definition at line 1084 of file cp_base.c.
References B_PackInitialEquipment(), CAP_ITEMS, base_s::capacities, ccs, CL_UpdateCredits(), ccs_s::credits, csi, cap_maxcur_s::cur, i, INV_GetEquipmentDefinitionByID(), INVSH_GetItemByIDX(), equipDef_s::numItems, csi_s::numODs, objDef_s::price, and objDef_s::size.
Referenced by B_SetUpFirstBase().
void B_InitStartup | ( | void | ) |
Resets console commands.
Definition at line 2410 of file cp_base.c.
References Cmd_AddCommand(), and Cvar_Get().
Referenced by CP_InitStartup().
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 2629 of file cp_base.c.
References objDef_s::idx, objDef_s::isVirtual, equipDef_s::numItems, and base_s::storage.
Referenced by AIR_Refuel(), PR_RequirementsMet(), RS_RequirementsMet(), TR_TransferListSelect_f(), and TR_TransferSelect().
Check if an item is stored in storage.
[in] | obj | Pointer to the item to check. |
Definition at line 3035 of file cp_base.c.
References ANTIMATTER_TECH_ID, objDef_s::id, objDef_s::isVirtual, qfalse, and qtrue.
Referenced by B_AddToStorage(), B_RemoveItemsExceedingCapacity(), B_UpdateStorageAndCapacity(), B_UpdateStorageCap(), CP_ItemsSanityCheck(), TR_EmptyTransferCargo(), TR_TransferList_Scroll_f(), TR_TransferListSelect_f(), and TR_TransferSelect().
int B_LoadBaseSlotsXML | ( | baseWeapon_t * | weapons, | |
int | max, | |||
mxml_node_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 2833 of file cp_base.c.
References AII_LoadOneSlotXML(), baseWeapon_s::autofire, mxml_GetBool(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), qtrue, SAVE_BASES_AUTOFIRE, SAVE_BASES_TARGET, SAVE_BASES_WEAPON, baseWeapon_s::target, and UFO_GetByIDX().
Referenced by B_LoadXML(), and INS_LoadXML().
qboolean B_LoadStorageXML | ( | mxml_node_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 2877 of file cp_base.c.
References Com_Printf(), objDef_s::idx, INVSH_GetItemByID(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetString(), equipDef_s::numItems, equipDef_s::numItemsLoose, qtrue, SAVE_BASES_ITEM, SAVE_BASES_NUM, SAVE_BASES_NUMLOOSE, and SAVE_BASES_ODS_ID.
Referenced by B_LoadXML().
qboolean B_LoadXML | ( | mxml_node_t * | parent | ) |
Loads base data.
[in] | parent | XML Node structure, where we get the information from |
Definition at line 2898 of file cp_base.c.
References AIRCRAFT_INBASE_INVALID, base_s::aircraftCurrent, base_s::alienInterest, B_GetBaseByIDX(), B_GetBaseIDX, B_GetBuildingIDX, B_GetBuildingTemplate(), B_GetFoundedBaseCount(), B_GetMaxBuildingLevel(), B_LoadBaseSlotsXML(), B_LoadStorageXML(), B_RADAR, B_UpdateBaseCount(), building_s::base, base_s::baseStatus, base_s::batteries, BDEF_InitialiseBaseSlots(), base_s::bEquipment, baseBuildingTile_s::blocked, baseBuildingTile_s::building, ccs_s::buildings, building_s::buildingStatus, building_s::buildTime, ccs, Com_GetConstIntFromNamespace(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), base_s::founded, building_s::idx, base_s::idx, base_s::lasers, building_s::level, base_s::map, MAX_BASE_SLOT, MAX_BUILDINGS, MAX_VAR, mxml_GetBool(), mxml_GetFloat(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetPos2(), mxml_GetPos3(), mxml_GetString(), base_s::name, ccs_s::numBases, base_s::numBatteries, ccs_s::numBuildings, base_s::numLasers, building_s::pos, base_s::pos, Q_strncpyz(), qfalse, qtrue, base_s::radar, RADAR_Initialise(), RADAR_InitialiseUFOs(), 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_CURRENTAIRCRAFTIDX, 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_s::storage, and building_s::timeStart.
Referenced by SAV_Init().
Manages antimatter (adding, removing) through Antimatter Storage Facility.
[in] | base | Pointer to the base. |
[in] | amount | quantity of antimatter to add/remove (> 0 even if antimatter is removed) |
[in] | add | True if we are adding antimatter, false when removing. |
Definition at line 3284 of file cp_base.c.
References _, ANTIMATTER_TECH_ID, B_ANTIMATTER, B_GetBuildingStatus(), CAP_ANTIMATTER, base_s::capacities, Com_Error(), Com_sprintf(), cp_messageBuffer, cap_maxcur_s::cur, ERR_DROP, objDef_s::idx, INVSH_GetItemByIDSilent(), lengthof, cap_maxcur_s::max, MS_AddNewMessage(), MSG_STANDARD, base_s::name, equipDef_s::numItems, qfalse, and base_s::storage.
Referenced by AIR_Refuel(), B_RemoveAntimatterExceedingCapacity(), PR_DisassembleItem(), PR_UpdateRequiredItemsInBasestorage(), TR_CargoListSelect_f(), TR_EmptyTransferCargo(), TR_TransferListClear_f(), and TR_TransferListSelect_f().
void B_MarkBuildingDestroy | ( | base_t * | base, | |
building_t * | building | |||
) |
Mark a building for destruction - you only have to confirm it now.
Definition at line 889 of file cp_base.c.
References _, B_ENTRANCE, B_GetCapacityFromBuildingType(), B_HANGAR, B_QUARTERS, B_SMALL_HANGAR, B_STATUS_WORKING, B_STORAGE, BASE_UNDER_ATTACK, base_s::baseStatus, base_s::buildingCurrent, building_s::buildingStatus, building_s::buildingType, base_s::capacities, building_s::capacity, ccs, cap_maxcur_s::cur, cap_maxcur_s::max, ccs_s::numBases, UI_Popup(), and UI_PopupButton().
Referenced by UI_BaseMapNodeRightClick().
static void B_MoveAircraftOnGeoscapeToOtherBases | ( | const base_t * | base | ) | [static] |
Will ensure that aircraft on geoscape are not stored in a base that no longer has any hangar left.
base | The base that is going to be destroyed |
Definition at line 802 of file cp_base.c.
References AIR_DestroyAircraft(), AIR_GetNextFromBase(), AIR_IsAircraftOnGeoscape(), AIR_MoveAircraftIntoNewHomebase(), B_GetBaseByIDX(), ccs, and ccs_s::numBases.
Referenced by B_Destroy().
static void B_NewBuilding | ( | base_t * | base, | |
building_t * | building | |||
) | [static] |
Build new building.
[in,out] | base | The base to construct the building in |
[in,out] | building | The building to construct |
Definition at line 1407 of file cp_base.c.
References B_BuildingStatus(), B_ConstructBuilding(), B_STATUS_UNDER_CONSTRUCTION, building_s::buildingStatus, Com_DPrintf(), and DEBUG_CLIENT.
Referenced by B_SetBuildingByClick().
static void B_PackInitialEquipment | ( | aircraft_t * | aircraft, | |
const equipDef_t * | ed | |||
) | [static] |
Assigns initial soldier equipment for the first base.
Definition at line 2121 of file cp_base.c.
References aircraft_s::acTeam, AIR_MoveEmployeeInventoryIntoStorage(), B_UpdateStorageCap(), chr_list_s::chr, employee_s::chr, CL_SwapSkills(), cls, Com_DPrintf(), linkedList_s::data, DEBUG_CLIENT, inventoryInterface_s::EquipActor, aircraft_s::homebase, client_static_s::i, linkedList_s::next, chr_list_s::num, and base_s::storage.
Referenced by B_InitialEquipment().
void B_ParseBaseTemplate | ( | const char * | name, | |
const char ** | text | |||
) |
Reads a base layout template.
Definition at line 1818 of file cp_base.c.
References BASE_SIZE, ccs_s::baseTemplates, baseBuildingTile_s::building, baseTemplate_s::buildings, ccs_s::buildingTemplates, byte, ccs, Com_EParse(), Com_EParseValue(), Com_Error(), Com_Parse(), Com_Printf(), cp_campaignPool, ERR_DROP, i, building_s::id, baseTemplate_s::id, building_s::mandatory, map, MAX_BASEBUILDINGS, MAX_BASETEMPLATES, MAX_BUILDINGS, building_s::maxCount, Mem_PoolStrDup, ccs_s::numBaseTemplates, baseTemplate_s::numBuildings, ccs_s::numBuildingTemplates, pos, baseBuildingTile_s::posX, baseBuildingTile_s::posY, qtrue, and V_POS.
Referenced by CL_ParseScriptSecond().
void B_ParseBuildings | ( | const char * | name, | |
const char ** | text, | |||
qboolean | link | |||
) |
Copies an entry from the building description file into the list of building types.
[in] | name | Unique test-id of a building_t. This is parsed from "building xxx" -> id=xxx. |
[in] | text | the whole following text that is part of the "building" item definition in .ufo. |
[in] | link | Bool value that decides whether to link the tech pointer in or not |
Definition at line 1665 of file cp_base.c.
References B_GetBuildingTemplate(), B_GetBuildingTypeByBuildingID(), building_s::base, ccs_s::buildingTemplates, building_s::buildingType, ccs, Com_DPrintf(), Com_EParse(), Com_EParseValue(), Com_Error(), Com_Parse(), Com_Printf(), cp_campaignPool, DEBUG_CLIENT, building_s::dependsBuilding, ERR_DROP, i, building_s::id, building_s::idx, MAX_BUILDING_TYPE, MAX_BUILDINGS, building_s::maxCount, Mem_PoolStrDup, Mem_PoolStrDupTo, ccs_s::numBuildingTemplates, value_s::ofs, qtrue, RS_GetTechByProvided(), value_s::size, value_s::string, building_s::tech, building_s::tpl, value_s::type, V_CLIENT_HUNK_STRING, V_NULL, V_TRANSLATION_STRING, and building_s::visible.
Referenced by CL_ParseScriptFirst(), and CL_ParseScriptSecond().
void B_PostLoadInit | ( | void | ) |
Set the capacity stuff for all the bases after loading a savegame.
Definition at line 2867 of file cp_base.c.
References B_PostLoadInitCapacity().
Referenced by SAV_GameActionsAfterLoad().
static void B_PostLoadInitCapacity | ( | void | ) | [static] |
Set the capacity stuff for all the bases after loading a savegame.
Definition at line 2850 of file cp_base.c.
References B_GetFoundedBaseByIDX(), B_ResetAllStatusAndCapacities(), and qtrue.
Referenced by B_PostLoadInit().
void B_RemoveAircraftExceedingCapacity | ( | base_t * | base, | |
buildingType_t | buildingType | |||
) |
Actions to perform when destroying one hangar.
[in] | base | Pointer to the base where hangar is destroyed. |
[in] | buildingType | Type of hangar: B_SMALL_HANGAR for small hangar, B_HANGAR for large hangar |
Definition at line 650 of file cp_base.c.
References AIR_DeleteAircraft(), AIR_GetNextFromBase(), AIR_IsAircraftInBase(), AIR_IsAircraftOnGeoscape(), AIRCRAFT_LARGE, AIRCRAFT_SMALL, B_GetCapacityFromBuildingType(), B_HANGAR, B_SMALL_HANGAR, base_s::capacities, CL_DisplayHomebasePopup(), Com_Error(), cap_maxcur_s::cur, ERR_DROP, cap_maxcur_s::max, MAX_AIRCRAFT, qfalse, and aircraft_s::size.
Referenced by B_BuildingOnDestroy_f().
void B_RemoveAntimatterExceedingCapacity | ( | base_t * | base | ) |
Remove exceeding antimatter if an antimatter tank has been destroyed.
[in] | base | Pointer to the base. |
Definition at line 3322 of file cp_base.c.
References B_ManageAntimatter(), CAP_ANTIMATTER, base_s::capacities, cap_maxcur_s::cur, cap_maxcur_s::max, and qfalse.
Referenced by B_Destroy_AntimaterStorage_f().
void B_RemoveItemsExceedingCapacity | ( | base_t * | base | ) |
Remove items until everything fits in storage.
[in] | base | Pointer to the base |
< Will contain idx of items that can be removed
Definition at line 3178 of file cp_base.c.
References B_ItemIsStoredInBaseStorage(), B_UpdateStorageAndCapacity(), CAP_ITEMS, base_s::capacities, Com_DPrintf(), csi, cap_maxcur_s::cur, DEBUG_CLIENT, E_CountHired(), E_DeleteEmployee(), E_GetHiredRobot(), EMPL_ROBOT, INVSH_GetItemByIDX(), cap_maxcur_s::max, MAX_OBJDEFS, equipDef_s::numItems, csi_s::numODs, qfalse, REMOVE_ELEM, and base_s::storage.
Referenced by B_BuildingOnDestroy_f().
Recalculate status and capacities of one base.
[in] | base | Pointer to the base where status and capacities must be recalculated |
[in] | firstEnable | qtrue if this is the first time the function is called for this base |
Definition at line 579 of file cp_base.c.
References AIR_UpdateHangarCapForAll(), AL_CountInBase(), B_CheckUpdateBuilding(), B_GetBuildingStatus(), B_GetBuildingTypeByCapacity(), B_GetNextBuilding(), B_MISC, B_SetBuildingStatus(), B_UpdateAntimatterCap(), B_UpdateBaseCapacities(), B_UpdateOneBaseBuildingStatusOnEnable(), B_UpdateStorageCap(), building_s::buildingType, CAP_AIRCRAFT_BIG, CAP_AIRCRAFT_SMALL, CAP_ALIENS, CAP_ANTIMATTER, CAP_EMPLOYEES, CAP_ITEMS, CAP_LABSPACE, CAP_WORKSPACE, base_s::capacities, Com_DPrintf(), Com_Printf(), cap_maxcur_s::cur, DEBUG_CLIENT, E_CountAllHired(), i, cap_maxcur_s::max, MAX_BUILDING_TYPE, MAX_CAP, base_s::name, PR_UpdateProductionCap(), qfalse, qtrue, and RS_CountScientistsInBase().
Referenced by B_BuildBase_f(), and B_PostLoadInitCapacity().
void B_ResetBuildingCurrent | ( | base_t * | base | ) |
Resets the buildingCurrent variable and baseAction.
[in,out] | base | Pointer to the base needs buildingCurrent to be reseted |
Definition at line 283 of file cp_base.c.
References BA_NONE, ccs_s::baseAction, base_s::buildingCurrent, and ccs.
Referenced by B_BuildingDestroy_f(), B_ConstructBuilding(), B_ResetBuildingCurrent_f(), and B_SetBuildingByClick().
void B_SaveBaseSlotsXML | ( | const baseWeapon_t * | weapons, | |
const int | numWeapons, | |||
mxml_node_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 2713 of file cp_base.c.
References AII_SaveOneSlotXML(), mxml_AddBoolValue(), mxml_AddInt(), mxml_AddNode(), qtrue, SAVE_BASES_AUTOFIRE, SAVE_BASES_TARGET, and SAVE_BASES_WEAPON.
Referenced by B_SaveXML(), and INS_SaveXML().
qboolean B_SaveStorageXML | ( | mxml_node_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 2731 of file cp_base.c.
References csi, objDef_s::id, INVSH_GetItemByIDX(), mxml_AddByteValue(), mxml_AddIntValue(), mxml_AddNode(), mxml_AddString(), equipDef_s::numItems, equipDef_s::numItemsLoose, csi_s::numODs, qtrue, SAVE_BASES_ITEM, SAVE_BASES_NUM, SAVE_BASES_NUMLOOSE, and SAVE_BASES_ODS_ID.
Referenced by B_SaveXML().
qboolean B_SaveXML | ( | mxml_node_t * | parent | ) |
Save callback for saving in xml format.
[out] | parent | XML Node structure, where we write the information to |
Definition at line 2750 of file cp_base.c.
References AIR_GetAircraftIDXInBase(), base_s::aircraftCurrent, base_s::alienInterest, B_GetBaseByIDX(), B_GetNextBuilding(), B_SaveBaseSlotsXML(), B_SaveStorageXML(), base_s::baseStatus, base_s::batteries, baseBuildingTile_s::blocked, baseBuildingTile_s::building, building_s::buildingStatus, building_s::buildTime, ccs, Com_GetConstVariable(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), base_s::founded, building_s::id, building_s::idx, base_s::idx, base_s::lasers, building_s::level, base_s::map, mxml_AddBoolValue(), mxml_AddFloat(), mxml_AddInt(), mxml_AddIntValue(), mxml_AddNode(), mxml_AddPos2(), mxml_AddPos3(), mxml_AddString(), base_s::name, ccs_s::numBases, base_s::numBatteries, base_s::numLasers, building_s::pos, base_s::pos, qfalse, qtrue, base_s::radar, radar_s::range, 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_CURRENTAIRCRAFTIDX, 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_s::storage, building_s::timeStart, building_s::tpl, and radar_s::trackingRange.
Referenced by SAV_Init().
qboolean B_ScriptSanityCheck | ( | void | ) |
Checks the parsed buildings for errors.
Definition at line 3141 of file cp_base.c.
References ccs_s::buildingTemplates, ccs, Com_Printf(), error(), building_s::id, building_s::image, building_s::mapPart, building_s::name, ccs_s::numBuildingTemplates, building_s::pedia, qfalse, qtrue, RS_GetTechByID(), and building_s::visible.
void B_SelectBase | ( | const base_t * | base | ) |
[in] | base | If this is NULL we want to build a new base |
Definition at line 1969 of file cp_base.c.
References B_SetCurrentSelectedBase(), ccs, Com_DPrintf(), DEBUG_CLIENT, base_s::idx, MA_NEWBASE, MA_NONE, MAP_IsRadarOverlayActivated(), MAP_ResetAction(), MAP_SetOverlay(), ccs_s::mapAction, MAX_BASES, ccs_s::numBases, and UI_PushWindow().
Referenced by B_BuildBase_f(), B_NextBase_f(), B_PrevBase_f(), B_SelectBase_f(), CL_PopupInterceptRClick_f(), CP_CampaignInit(), and MAP_MultiSelectExecuteAction_f().
static void B_SellOrAddItems | ( | aircraft_t * | aircraft | ) | [static] |
Sell items to the market or add them to base storage.
[in] | aircraft | Pointer to an aircraft landing in base. |
Definition at line 2500 of file cp_base.c.
References _, itemsTmp_s::amount, market_s::autosell, B_UpdateStorageAndCapacity(), B_UpdateStorageCap(), BS_AddItemToMarket(), ccs, CL_UpdateCredits(), Com_sprintf(), cp_messageBuffer, ccs_s::credits, ccs_s::eMarket, aircraft_s::homebase, objDef_s::idx, itemsTmp_s::item, aircraft_s::itemcargo, aircraft_s::itemTypes, lengthof, MS_AddNewMessage(), MSG_STANDARD, base_s::name, ngettext, objDef_s::price, qfalse, qtrue, RS_GetTechForItem(), RS_IsResearched_ptr(), RS_MarkCollected(), RS_MarkResearchable(), and va().
Referenced by B_DumpAircraftToHomeBase().
building_t* B_SetBuildingByClick | ( | base_t * | base, | |
const building_t const * | buildingTemplate, | |||
int | row, | |||
int | col | |||
) |
Set the currently selected building.
[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 1429 of file cp_base.c.
References _, B_CheckCredits(), B_GetBuildingIDX, B_NewBuilding(), B_ResetBuildingCurrent(), building_s::base, BASE_SIZE, baseBuildingTile_s::blocked, baseBuildingTile_s::building, ccs_s::buildings, ccs, Cmd_ExecuteString(), Com_DPrintf(), Com_Error(), DEBUG_CLIENT, ERR_DROP, building_s::fixCosts, building_s::idx, base_s::idx, base_s::map, building_s::needs, ccs_s::numBuildings, building_s::pos, and UI_Popup().
Referenced by B_AddBuildingToBasePos(), and UI_BaseMapNodeClick().
void B_SetBuildingStatus | ( | base_t *const | base, | |
const buildingType_t | buildingType, | |||
qboolean | 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 244 of file cp_base.c.
References B_MISC, Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, base_s::hasBuilding, and MAX_BUILDING_TYPE.
Referenced by B_BuildingDestroy(), B_CheckUpdateBuilding(), and B_ResetAllStatusAndCapacities().
void B_SetCurrentSelectedBase | ( | const base_t * | base | ) |
base |
Definition at line 1927 of file cp_base.c.
References AIR_GetNextFromBase(), base_s::aircraftCurrent, B_GetBaseByIDX(), base_s::baseStatus, Com_Error(), Cvar_Set(), Cvar_SetValue(), ERR_DROP, base_s::founded, i, INS_SetCurrentSelectedInstallation(), MAX_BASES, base_s::name, qfalse, qtrue, and base_s::selected.
Referenced by B_SelectBase(), CP_BaseAttackStartMission(), and INS_SetCurrentSelectedInstallation().
Setup new base, uses template for the first base.
[in,out] | base | The base to set up |
[in] | pos | Position (on Geoscape) the base built at |
Definition at line 1284 of file cp_base.c.
References base_s::aircraft, base_s::alienInterest, B_BuildFromTemplate(), B_GetBaseIDX, B_SetUpFirstBase(), BASE_WORKING, stats_s::basesBuilt, base_s::baseStatus, BDEF_InitialiseBaseSlots(), ccs_s::campaignStats, ccs, base_s::founded, base_s::idx, LIST_Delete(), base_s::pos, qtrue, base_s::radar, RADAR_Initialise(), RADAR_InitialiseUFOs(), and Vector2Copy.
Referenced by B_BuildBase_f().
static void B_SetUpFirstBase | ( | base_t * | base | ) | [static] |
Setup buildings and equipment for first base. Uses the campaign scriptable first base template to place the buildings in the base.
[in,out] | base | The base to set up |
Definition at line 1190 of file cp_base.c.
References AIM_AutoEquipAircraft(), AIR_AssignInitial(), AIR_GetAircraft(), AIR_GetNextFromBase(), AIR_NewAircraft(), AIRCRAFT_INTERCEPTOR, AIRCRAFT_TRANSPORTER, B_BuildFromTemplate(), B_GetBuildingStatus(), B_HANGAR, B_InitialEquipment(), B_SMALL_HANGAR, BS_InitMarket(), ccs, CL_UpdateCredits(), Com_DPrintf(), Com_DropShipTypeToShortName(), Com_Error(), ccs_s::credits, ccs_s::curCampaign, DEBUG_CLIENT, DROPSHIP_FIREBIRD, E_HireEmployeeByType(), E_InitialEmployees(), EMPL_PILOT, campaign_s::equipment, ERR_DROP, campaign_s::firstBaseTemplate, INTERCEPTOR_STILETTO, INV_GetEquipmentDefinitionByID(), aircraft_s::price, qtrue, RS_MarkResearchable(), base_s::storage, cvar_s::string, and aircraft_s::type.
Referenced by B_SetUpBase().
static void B_UpdateAllBaseBuildingStatus | ( | building_t * | building, | |
base_t * | base, | |||
buildingStatus_t | status | |||
) | [static] |
Updates base status for particular buildings as well as capacities.
[in] | building | Pointer to building. |
[in] | base | Pointer to base with given building. |
[in] | status | Enum of buildingStatus_t which is status of given building. |
Definition at line 1007 of file cp_base.c.
References B_CheckBuildingDependencesStatus(), B_CheckUpdateBuilding(), B_GetCapacityFromBuildingType(), B_STATUS_CONSTRUCTION_FINISHED, B_STATUS_UNDER_CONSTRUCTION, B_STATUS_WORKING, B_UpdateBaseCapacities(), B_UpdateOneBaseBuildingStatusOnEnable(), B_UpdateStatusBuilding(), building_s::buildingStatus, building_s::buildingType, CL_GameTimeStop(), MAX_CAP, and qtrue.
Referenced by B_AddBuildingToBasePos(), and B_CheckBuildingConstruction().
static void B_UpdateAntimatterCap | ( | base_t * | base | ) | [static] |
Update Antimatter Capacity.
[in] | base | Pointer to the base |
Definition at line 554 of file cp_base.c.
References ANTIMATTER_TECH_ID, CAP_ANTIMATTER, base_s::capacities, cap_maxcur_s::cur, objDef_s::idx, INVSH_GetItemByID(), equipDef_s::numItems, and base_s::storage.
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 2656 of file cp_base.c.
References B_GetBuildingTypeByCapacity(), B_GetNextBuildingByType(), B_STATUS_CONSTRUCTION_FINISHED, B_UpdateBaseCapacities(), building_s::buildingStatus, ccs_s::buildingTemplates, building_s::buildingType, CAP_AIRCRAFT_BIG, CAP_AIRCRAFT_SMALL, CAP_ALIENS, CAP_ANTIMATTER, CAP_EMPLOYEES, CAP_ITEMS, CAP_LABSPACE, CAP_WORKSPACE, base_s::capacities, building_s::capacity, ccs, Com_DPrintf(), Com_Error(), DEBUG_CLIENT, ERR_DROP, building_s::id, cap_maxcur_s::max, and ccs_s::numBuildingTemplates.
Referenced by B_BuildingDestroy(), B_ResetAllStatusAndCapacities(), B_UpdateAllBaseBuildingStatus(), and B_UpdateBaseCapacities().
void B_UpdateBaseCount | ( | void | ) |
Update menu script related cvars when the amount of bases changed.
Definition at line 1270 of file cp_base.c.
References ccs, Cvar_SetValue(), and ccs_s::numBases.
Referenced by B_BuildBase_f(), and B_LoadXML().
void B_UpdateBaseData | ( | void | ) |
Updates base data.
Definition at line 2447 of file cp_base.c.
References _, B_CheckBuildingConstruction(), B_GetFoundedBaseByIDX(), B_GetNextBuilding(), ccs_s::bases, ccs, Com_sprintf(), cp_messageBuffer, lengthof, MS_AddNewMessage(), MSG_CONSTRUCTION, base_s::name, building_s::name, and qfalse.
Referenced by CL_CampaignRun().
static void B_UpdateOneBaseBuildingStatusOnDisable | ( | buildingType_t | type, | |
base_t * | base | |||
) | [static] |
Actions to perform when a type of buildings goes from functional to non-functional.
[in] | type | Type of building which hasBuilding value has been modified from qtrue to qfalse |
[in] | base | Pointer to base with given building. |
Definition at line 468 of file cp_base.c.
References AC_KillAll(), B_ALIEN_CONTAINMENT, B_COMMAND, B_RADAR, Cmd_ExecuteString(), base_s::idx, and va().
Referenced by B_UpdateStatusBuilding().
static void B_UpdateOneBaseBuildingStatusOnEnable | ( | buildingType_t | type, | |
base_t * | base | |||
) | [static] |
Actions to perform when a type of buildings goes from qfalse to qtrue.
[in] | type | Type of building that has been modified from qfalse to qtrue |
[in] | base | Pointer to base with given building. |
Definition at line 445 of file cp_base.c.
References B_COMMAND, B_RADAR, Cmd_ExecuteString(), base_s::idx, and va().
Referenced by B_ResetAllStatusAndCapacities(), B_UpdateAllBaseBuildingStatus(), and B_UpdateStatusBuilding().
static qboolean B_UpdateStatusBuilding | ( | base_t * | base, | |
buildingType_t | buildingType, | |||
qboolean | onBuilt | |||
) | [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 | qtrue if building has been built, qfalse else |
Definition at line 495 of file cp_base.c.
References B_CheckUpdateBuilding(), B_GetBuildingStatus(), B_GetNextBuilding(), B_UpdateOneBaseBuildingStatusOnDisable(), B_UpdateOneBaseBuildingStatusOnEnable(), building_s::buildingType, building_s::dependsBuilding, qfalse, and qtrue.
Referenced by B_BuildingDestroy(), and B_UpdateAllBaseBuildingStatus().
qboolean B_UpdateStorageAndCapacity | ( | base_t * | base, | |
const objDef_t * | obj, | |||
int | amount, | |||
qboolean | reset, | |||
qboolean | ignorecap | |||
) |
Update the storage amount and the capacities for the storages in the base.
[in] | base | The base which storage and capacity should be updated |
[in] | obj | The item. |
[in] | amount | Amount to be added to removed |
[in] | reset | Set this to true (amount is not needed) if you want to reset the storage amount and capacities (e.g. in case of a base ransack) |
[in] | ignorecap | qtrue if we won't check freespace but will just add items. |
Definition at line 3093 of file cp_base.c.
References B_ItemIsStoredInBaseStorage(), CAP_ITEMS, base_s::capacities, Com_DPrintf(), Com_Printf(), cap_maxcur_s::cur, DEBUG_CLIENT, objDef_s::id, objDef_s::idx, objDef_s::isVirtual, cap_maxcur_s::max, equipDef_s::numItems, equipDef_s::numItemsLoose, qfalse, qtrue, objDef_s::size, and base_s::storage.
Referenced by AII_AddAmmoToSlot(), AII_AddItemToSlot(), AII_ReloadWeapon(), AII_RemoveItemFromSlot(), AII_RemoveNextItemFromSlot(), AIR_TransferItemsCarriedByCharacterToBase(), B_RemoveItemsExceedingCapacity(), B_SellOrAddItems(), BS_BuyItem_f(), BS_CheckAndDoBuyItem(), BS_SellItem_f(), E_RemoveInventoryFromStorage(), PR_DisassembleItem(), PR_ProductionFrame(), TR_CargoListSelect_f(), TR_EmptyTransferCargo(), TR_TransferListClear_f(), and TR_TransferListSelect_f().
void B_UpdateStorageCap | ( | base_t * | base | ) |
Update Storage Capacity.
[in] | base | Pointer to the base |
Definition at line 3237 of file cp_base.c.
References B_ItemIsStoredInBaseStorage(), CAP_ITEMS, base_s::capacities, csi, cap_maxcur_s::cur, E_CountHired(), EMPL_ROBOT, INVSH_GetItemByIDX(), equipDef_s::numItems, csi_s::numODs, objDef_s::size, base_s::storage, and UGV_SIZE.
Referenced by B_PackInitialEquipment(), B_ResetAllStatusAndCapacities(), B_SellOrAddItems(), and CP_BaseAttackMissionDestroyBase().
static void CL_DoSwapSkills | ( | character_t * | cp1, | |
character_t * | cp2, | |||
const int | skill | |||
) | [static] |
Definition at line 2018 of file cp_base.c.
References ABILITY_ACCURACY, ABILITY_MIND, ABILITY_POWER, ABILITY_SPEED, CL_SwapSkill(), Com_Error(), ERR_DROP, character_s::score, SKILL_ASSAULT, SKILL_CLOSE, SKILL_EXPLOSIVE, SKILL_HEAVY, SKILL_SNIPER, and chrScoreGlobal_s::skills.
Referenced by CL_SwapSkills().
static void CL_SwapSkill | ( | character_t * | cp1, | |
character_t * | cp2, | |||
abilityskills_t | skill | |||
) | [static] |
Swaps one skill from character1 to character 2 and vice versa.
Definition at line 1999 of file cp_base.c.
References chrScoreGlobal_s::experience, chrScoreGlobal_s::initialSkills, character_s::score, and chrScoreGlobal_s::skills.
Referenced by CL_DoSwapSkills().
static void CL_SwapSkills | ( | chrList_t * | team | ) | [static] |
Swaps skills of the initial team of soldiers so that they match inventories.
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 2053 of file cp_base.c.
References ABILITY_NUM_TYPES, byte, chr_list_s::chr, CL_DoSwapSkills(), FIRESH_FiredefForWeapon(), HOLSTER, i, chr_list_s::num, RIGHT, SKILL_NUM_TYPES, and fireDef_s::weapFdsIdx.
Referenced by B_PackInitialEquipment().
cvar_t* cp_initial_equipment [static] |
Coordinates to place the new base at (long, lat)
Definition at line 43 of file cp_base.c.
Referenced by B_BuildBase_f(), INS_BuildInstallation_f(), and MAP_MapClick().
const value_t valid_building_vars[] [static] |
{ {"map_name", V_CLIENT_HUNK_STRING, offsetof(building_t, mapPart), 0}, {"max_count", V_INT, offsetof(building_t, maxCount), MEMBER_SIZEOF(building_t, maxCount)}, {"level", V_FLOAT, offsetof(building_t, level), MEMBER_SIZEOF(building_t, level)}, {"name", V_TRANSLATION_STRING, offsetof(building_t, name), 0}, {"pedia", V_CLIENT_HUNK_STRING, offsetof(building_t, pedia), 0}, {"status", V_INT, offsetof(building_t, buildingStatus), MEMBER_SIZEOF(building_t, buildingStatus)}, {"image", V_CLIENT_HUNK_STRING, offsetof(building_t, image), 0}, {"visible", V_BOOL, offsetof(building_t, visible), MEMBER_SIZEOF(building_t, visible)}, {"needs", V_CLIENT_HUNK_STRING, offsetof(building_t, needs), 0}, {"fixcosts", V_INT, offsetof(building_t, fixCosts), MEMBER_SIZEOF(building_t, fixCosts)}, {"varcosts", V_INT, offsetof(building_t, varCosts), MEMBER_SIZEOF(building_t, varCosts)}, {"build_time", V_INT, offsetof(building_t, buildTime), MEMBER_SIZEOF(building_t, buildTime)}, {"starting_employees", V_INT, offsetof(building_t, maxEmployees), MEMBER_SIZEOF(building_t, maxEmployees)}, {"capacity", V_INT, offsetof(building_t, capacity), MEMBER_SIZEOF(building_t, capacity)}, {"onconstruct", V_STRING, offsetof(building_t, onConstruct), 0}, {"onattack", V_STRING, offsetof(building_t, onAttack), 0}, {"ondestroy", V_STRING, offsetof(building_t, onDestroy), 0}, {"mandatory", V_BOOL, offsetof(building_t, mandatory), MEMBER_SIZEOF(building_t, mandatory)}, {NULL, 0, 0, 0} }
Holds the names of valid entries in the basemanagement.ufo file.
The valid definition names for BUILDINGS (building_t) in the basemanagement.ufo file. to the appropriate values in the corresponding struct