Header for base management related stuff. More...
#include "cp_aliencont.h"
Go to the source code of this file.
Data Structures | |
struct | cap_maxcur_s |
Store capacities in base. More... | |
struct | building_s |
A building with all it's data. More... | |
struct | baseBuildingTile_s |
struct | baseWeapon_s |
struct | base_s |
A base with all it's data. More... | |
struct | baseTemplate_s |
template for creating a base More... | |
Defines | |
#define | MAX_BASES 8 |
#define | MAX_BUILDINGS 32 |
#define | MAX_BASETEMPLATES 5 |
#define | MAX_BATTERY_DAMAGE 50 |
#define | MAX_BASE_DAMAGE 100 |
#define | MAX_BASE_SLOT 4 |
#define | BASEMAP_SIZE_X 778.0 |
#define | BASEMAP_SIZE_Y 672.0 |
#define | BASE_SIZE 5 |
#define | MAX_BASEBUILDINGS BASE_SIZE * BASE_SIZE |
#define | MAX_EMPLOYEES_IN_BUILDING 64 |
#define | MAX_BLOCKEDFIELDS 4 |
#define | MIN_BLOCKEDFIELDS 1 |
#define | BASE_TILE_SIZE 512 |
#define | BASE_TILE_UNITS (BASE_TILE_SIZE / UNIT_SIZE) |
#define | BASE_MAX_WORLDLEVEL 6 |
#define | B_GetBaseIDX(base) ((ptrdiff_t)((base) - ccs.bases)) |
#define | B_GetBuildingIDX(base, building) ((ptrdiff_t)((building) - ccs.buildings[base->idx])) |
#define | B_BuildingSetUsed(usedArray, buildingIDX) { (usedArray)[buildingIDX] = qtrue; } |
Macro sets a building used. | |
#define | B_BuildingGetUsed(usedArray, buildingIDX) ((usedArray)[buildingIDX]) |
Macro returns if a building is used. | |
Typedefs | |
typedef struct cap_maxcur_s | capacities_t |
Store capacities in base. | |
typedef struct building_s | building_t |
A building with all it's data. | |
typedef struct baseBuildingTile_s | baseBuildingTile_t |
typedef struct baseWeapon_s | baseWeapon_t |
typedef struct base_s | base_t |
A base with all it's data. | |
typedef struct baseTemplate_s | baseTemplate_t |
template for creating a base | |
Enumerations | |
enum | baseStatus_t { BASE_NOT_USED, BASE_UNDER_ATTACK, BASE_WORKING, BASE_DESTROYED } |
Possible base states. More... | |
enum | baseAction_t { BA_NONE, BA_NEWBUILDING, BA_MAX } |
All possible base actions. More... | |
enum | buildingStatus_t { B_STATUS_NOT_SET, B_STATUS_UNDER_CONSTRUCTION, B_STATUS_CONSTRUCTION_FINISHED, B_STATUS_WORKING, B_STATUS_DOWN } |
All possible building status. More... | |
enum | buildingType_t { B_MISC, B_LAB, B_QUARTERS, B_STORAGE, B_WORKSHOP, B_HOSPITAL, B_HANGAR, B_ALIEN_CONTAINMENT, B_SMALL_HANGAR, B_POWER, B_COMMAND, B_ANTIMATTER, B_ENTRANCE, B_DEFENCE_MISSILE, B_DEFENCE_LASER, B_RADAR, MAX_BUILDING_TYPE } |
All different building types. More... | |
enum | baseCapacities_t { CAP_ALIENS, CAP_AIRCRAFT_SMALL, CAP_AIRCRAFT_BIG, CAP_EMPLOYEES, CAP_ITEMS, CAP_LABSPACE, CAP_WORKSPACE, CAP_ANTIMATTER, MAX_CAP } |
All possible capacities in base. More... | |
Functions | |
void | B_UpdateBaseData (void) |
Updates base data. | |
int | B_CheckBuildingConstruction (building_t *b, base_t *base) |
Checks whether the construction of a building is finished. Calls the onConstruct functions and assign workers, too. | |
float | B_GetMaxBuildingLevel (const base_t *base, const buildingType_t type) |
Get the maximum level of a building type in a base. | |
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. | |
void | B_ParseBaseTemplate (const char *name, const char **text) |
Reads a base layout template. | |
void | B_BaseResetStatus (base_t *const base) |
Sets the baseStatus to BASE_NOT_USED. | |
building_t * | B_GetBuildingInBaseByType (const base_t *base, buildingType_t type, qboolean onlyWorking) |
Gets a building of a given type in the given 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 *baseTemplateName) |
Returns the baseTemplate in the global baseTemplate list that has the unique name baseTemplateID. | |
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_InitStartup (void) |
Resets console commands. | |
void | B_NewBases (void) |
void | B_SetUpBase (base_t *base, vec2_t pos) |
Setup new base, uses template 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. | |
void | B_SelectBase (const base_t *base) |
void | B_UpdateBaseCount (void) |
Update menu script related cvars when the amount of bases changed. | |
int | B_GetFoundedBaseCount (void) |
Counts the number of bases. | |
void | B_Destroy (base_t *base) |
Destroy a base. | |
base_t * | B_GetFirstUnfoundedBase (void) |
Get the lower IDX of unfounded base. | |
base_t * | B_GetCurrentSelectedBase (void) |
void | B_SetCurrentSelectedBase (const base_t *base) |
qboolean | B_AssembleMap (const base_t *base) |
Perform the base assembling in case of an alien attack. | |
buildingType_t | B_GetBuildingTypeByCapacity (baseCapacities_t cap) |
Get building type by base capacity. | |
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. | |
void | B_BuildingStatus (const base_t *base, const building_t *building) |
Displays the status of a building for baseview. | |
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. | |
qboolean | B_GetBuildingStatus (const base_t *const base, const buildingType_t type) |
Get the status associated to a building. | |
void | B_SetBuildingStatus (base_t *const base, const buildingType_t type, 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. | |
building_t * | B_SetBuildingByClick (base_t *base, const building_t const *buildingTemplate, int row, int col) |
Set the currently selected building. | |
void | B_MarkBuildingDestroy (base_t *base, building_t *building) |
Mark a building for destruction - you only have to confirm it now. | |
qboolean | B_BuildingDestroy (base_t *base, building_t *building) |
Removes a building from the given base. | |
building_t * | B_GetFreeBuildingType (buildingType_t type) |
int | B_GetNumberOfBuildingsInBaseByTemplate (const base_t *base, const building_t *type) |
Counts the number of buildings of a particular type in a base. | |
int | B_GetNumberOfBuildingsInBaseByBuildingType (const base_t *base, const buildingType_t type) |
Counts the number of buildings of a particular buuilding type in a base. | |
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_ResetBuildingCurrent (base_t *base) |
Resets the buildingCurrent variable and baseAction. | |
qboolean | B_ItemIsStoredInBaseStorage (const objDef_t *obj) |
Check if an item is stored in storage. | |
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. | |
int | B_AddToStorage (base_t *base, const objDef_t *obj, int amount) |
Add/remove items to/from the storage. | |
void | B_AircraftReturnedToHomeBase (aircraft_t *aircraft) |
Do anything when dropship returns to base. | |
void | B_DumpAircraftToHomeBase (aircraft_t *aircraft) |
Will unload all cargo to the homebase. | |
void | B_UpdateBaseCapacities (baseCapacities_t cap, base_t *base) |
Updates base capacities. | |
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. | |
baseCapacities_t | B_GetCapacityFromBuildingType (buildingType_t type) |
Get the capacity associated to a building type. | |
void | B_ResetAllStatusAndCapacities (base_t *base, qboolean firstEnable) |
Recalculate status and capacities of one base. | |
void | B_UpdateStorageCap (base_t *base) |
Update Storage Capacity. | |
void | B_RemoveAircraftExceedingCapacity (base_t *base, buildingType_t buildingType) |
Actions to perform when destroying one hangar. | |
void | B_RemoveItemsExceedingCapacity (base_t *base) |
Remove items until everything fits in storage. | |
void | B_RemoveAntimatterExceedingCapacity (base_t *base) |
Remove exceeding antimatter if an antimatter tank has been destroyed. | |
int | B_FreeCapacity (const base_t *base, baseCapacities_t cap) |
Returns the free capacity of a type. | |
void | B_BaseMenuInit (const base_t *base) |
void | B_DrawBuilding (base_t *base, building_t *building) |
Draws a building. | |
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_SaveBaseSlotsXML (const baseWeapon_t *weapons, const int numWeapons, mxml_node_t *p) |
Saves the missile and laser slots of a base or sam site. | |
int | B_LoadBaseSlotsXML (baseWeapon_t *weapons, int numWeapons, mxml_node_t *p) |
Loads 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_LoadStorageXML (mxml_node_t *parent, equipDef_t *equip) |
Loads base storage. | |
qboolean | B_ScriptSanityCheck (void) |
Checks the parsed buildings for errors. | |
int | B_GetInstallationLimit (void) |
Counts the actual installation count limit. | |
qboolean | BS_BuySellAllowed (const base_t *base) |
Returns true if you can buy or sell equipment. | |
qboolean | AIR_AircraftAllowed (const base_t *base) |
Returns true if the current base is able to handle aircraft. | |
qboolean | RS_ResearchAllowed (const base_t *base) |
Returns true if the current base is able to handle research. | |
qboolean | PR_ProductionAllowed (const base_t *base) |
Returns true if the current base is able to produce items. | |
qboolean | E_HireAllowed (const base_t *base) |
Returns true if the current base is able to handle employees. | |
qboolean | AC_ContainmentAllowed (const base_t *base) |
Returns true if the current base is able to handle captured aliens. | |
qboolean | HOS_HospitalAllowed (const base_t *base) |
Returns true if you can enter in the hospital. | |
Variables | |
vec2_t | newBasePos |
Header for base management related stuff.
Definition in file cp_base.h.
#define B_BuildingGetUsed | ( | usedArray, | |||
buildingIDX | ) | ((usedArray)[buildingIDX]) |
Macro returns if a building is used.
[in] | usedArray | must be a qboolean array of the size MAX_BUILDINGS |
[in] | buildingIDX | Index of building to check |
Definition at line 75 of file cp_base.h.
Referenced by B_AssembleMap(), and UI_BaseMapNodeDraw().
#define B_BuildingSetUsed | ( | usedArray, | |||
buildingIDX | ) | { (usedArray)[buildingIDX] = qtrue; } |
Macro sets a building used.
[in] | usedArray | must be a qboolean array of the size MAX_BUILDINGS |
[in] | buildingIDX | Index of building to set used |
Definition at line 69 of file cp_base.h.
Referenced by B_AssembleMap(), and UI_BaseMapNodeDraw().
#define B_GetBaseIDX | ( | base | ) | ((ptrdiff_t)((base) - ccs.bases)) |
Definition at line 61 of file cp_base.h.
Referenced by B_LoadXML(), and B_SetUpBase().
#define B_GetBuildingIDX | ( | base, | |||
building | ) | ((ptrdiff_t)((building) - ccs.buildings[base->idx])) |
Definition at line 62 of file cp_base.h.
Referenced by B_LoadXML(), and B_SetBuildingByClick().
#define BASE_MAX_WORLDLEVEL 6 |
Definition at line 59 of file cp_base.h.
Referenced by B_AssembleMap().
#define BASE_SIZE 5 |
Definition at line 45 of file cp_base.h.
Referenced by B_AssembleMap(), B_BuildFromTemplate(), B_BuildingInit(), B_ParseBaseTemplate(), B_SetBuildingByClick(), UI_BaseLayoutNodeDraw(), UI_BaseMapGetCellAtPos(), UI_BaseMapIsCellFree(), and UI_BaseMapNodeDraw().
#define BASE_TILE_SIZE 512 |
#define BASE_TILE_UNITS (BASE_TILE_SIZE / UNIT_SIZE) |
Definition at line 58 of file cp_base.h.
Referenced by B_AssembleMap().
#define BASEMAP_SIZE_X 778.0 |
#define MAX_BASE_SLOT 4 |
Definition at line 38 of file cp_base.h.
Referenced by B_LoadXML(), BDEF_AddBattery(), and BDEF_InitialiseBaseSlots().
#define MAX_BASEBUILDINGS BASE_SIZE * BASE_SIZE |
Definition at line 46 of file cp_base.h.
Referenced by B_ParseBaseTemplate().
#define MAX_BASES 8 |
Definition at line 31 of file cp_base.h.
Referenced by AB_UpdateStealthForAllBase(), AC_LoadXML(), AC_SaveXML(), AII_RepairAircraft(), AII_UpdateInstallationDelay(), AIRFIGHT_CampaignRunBaseDefence(), AL_CountAll(), AL_CountForMenu(), B_BuildingOnDestroy_f(), B_GetBaseByIDX(), B_GetCurrentSelectedBase(), B_GetFirstUnfoundedBase(), B_InitCallbacks(), B_SelectBase(), B_SelectBase_f(), B_SetBaseTitle_f(), B_SetCurrentSelectedBase(), CL_DisplayHomebasePopup(), CL_PopupInterceptBaseClick_f(), CL_StatsUpdate_f(), CP_CheckBaseAttacks_f(), CP_NationHandleBudget(), E_DeleteEmployee(), MAP_DrawMapMarkers(), MAP_GetGeoscapeAngle(), MAP_MapClick(), MAP_PositionCloseToBase(), PR_LoadXML(), PR_ProductionRun(), RADAR_AddDetectedUFOToEveryRadar(), RADAR_CheckRadarSensored(), RADAR_DeactivateRadarOverlay(), RADAR_NotifyUFORemoved(), RADAR_UpdateBaseRadarCoverage_f(), RADAR_UpdateStaticRadarCoverage(), RADAR_UpdateWholeRadarOverlay(), RS_InitGUI(), RS_InitGUIData(), RS_ResearchRun(), UFO_SearchAircraftTarget(), UFO_UpdateAlienInterestForAllBasesAndInstallations(), UI_AbstractBaseNodeLoaded(), and UI_BaseLayoutNodeDraw().
#define MAX_BASETEMPLATES 5 |
Definition at line 34 of file cp_base.h.
Referenced by B_ParseBaseTemplate().
#define MAX_BLOCKEDFIELDS 4 |
Definition at line 50 of file cp_base.h.
Referenced by B_BuildFromTemplate().
#define MAX_BUILDINGS 32 |
Definition at line 33 of file cp_base.h.
Referenced by B_AssembleMap(), B_LoadXML(), B_ParseBaseTemplate(), B_ParseBuildings(), and UI_BaseMapNodeDraw().
#define MIN_BLOCKEDFIELDS 1 |
Definition at line 51 of file cp_base.h.
Referenced by B_BuildFromTemplate().
typedef struct baseBuildingTile_s baseBuildingTile_t |
typedef struct baseTemplate_s baseTemplate_t |
template for creating a base
typedef struct baseWeapon_s baseWeapon_t |
typedef struct building_s building_t |
A building with all it's data.
typedef struct cap_maxcur_s capacities_t |
Store capacities in base.
enum baseAction_t |
enum baseCapacities_t |
All possible capacities in base.
enum baseStatus_t |
enum buildingStatus_t |
All possible building status.
enum buildingType_t |
All different building types.
Returns true if the current base is able to handle captured aliens.
Definition at line 791 of file cp_aliencont.c.
References B_ALIEN_CONTAINMENT, B_GetBuildingStatus(), qfalse, and qtrue.
Referenced by AC_SaveXML(), B_BaseInit_f(), B_BuildingOpenAfterClick(), CP_TransferOfAliensToOtherBaseNeeded(), and TR_TransferAliensFromMission_f().
Returns true if the current base is able to handle aircraft.
Definition at line 2905 of file cp_aircraft.c.
References B_GetBuildingStatus(), B_HANGAR, and B_SMALL_HANGAR.
Referenced by B_BaseInit_f(), and B_BuildingOpenAfterClick().
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_BaseMenuInit | ( | const base_t * | base | ) |
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.
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 * | b, | |
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().
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().
building_t* B_GetFreeBuildingType | ( | buildingType_t | type | ) |
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().
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().
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().
void B_NewBases | ( | void | ) |
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_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_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().
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().
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().
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().
Returns true if you can buy or sell equipment.
[in] | base | Pointer to base to check on |
Definition at line 408 of file cp_market.c.
References B_GetBuildingStatus(), B_STORAGE, BASE_UNDER_ATTACK, base_s::baseStatus, qfalse, and qtrue.
Referenced by B_BaseInit_f(), and B_BuildingOpenAfterClick().
Returns true if the current base is able to handle employees.
Definition at line 1350 of file cp_employee.c.
References B_GetBuildingStatus(), B_QUARTERS, BASE_UNDER_ATTACK, base_s::baseStatus, qfalse, and qtrue.
Referenced by B_BaseInit_f(), and B_BuildingOpenAfterClick().
Returns true if you can enter in the hospital.
Definition at line 205 of file cp_hospital.c.
References B_GetBuildingStatus(), B_HOSPITAL, BASE_UNDER_ATTACK, base_s::baseStatus, qfalse, and qtrue.
Referenced by B_BaseInit_f(), and B_BuildingOpenAfterClick().
Returns true if the current base is able to produce items.
[in] | base | Pointer to the base. |
Definition at line 726 of file cp_produce.c.
References B_GetBuildingStatus(), B_WORKSHOP, BASE_UNDER_ATTACK, base_s::baseStatus, E_CountHired(), EMPL_WORKER, qfalse, and qtrue.
Referenced by B_BaseInit_f(), B_BuildingOpenAfterClick(), PR_ProductionRun(), and TR_TransferStart().
Returns true if the current base is able to handle research.
Definition at line 1916 of file cp_research.c.
References B_GetBuildingStatus(), B_LAB, BASE_UNDER_ATTACK, base_s::baseStatus, E_CountHired(), EMPL_SCIENTIST, qfalse, and qtrue.
Referenced by B_BaseInit_f(), B_BuildingOpenAfterClick(), RS_ResearchRun(), and TR_TransferStart().
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().