UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_capacity.cpp File Reference
#include "../../cl_shared.h"
#include "cp_campaign.h"
#include "cp_capacity.h"
#include "cp_aircraft.h"
#include "cp_missions.h"
#include "cp_geoscape.h"
#include "cp_popup.h"
#include "cp_time.h"
#include "cp_ufo.h"

Go to the source code of this file.

Functions

void CAP_RemoveAntimatterExceedingCapacity (base_t *base)
 Remove exceeding antimatter if an antimatter tank has been destroyed. More...
 
void CAP_UpdateStorageCap (base_t *base)
 Update Storage Capacity. More...
 
void CAP_SetMax (base_t *base, baseCapacities_t capacity, int value)
 Sets the maximal capacity on a base. More...
 
void CAP_AddMax (base_t *base, baseCapacities_t capacity, int value)
 Changes the maximal capacity on a base. More...
 
void CAP_SetCurrent (base_t *base, baseCapacities_t capacity, int value)
 Sets the current (used) capacity on a base. More...
 
void CAP_AddCurrent (base_t *base, baseCapacities_t capacity, int value)
 Changes the current (used) capacity on a base. More...
 
int CAP_GetFreeCapacity (const base_t *base, baseCapacities_t capacityType)
 Returns the free capacity of a type. More...
 
void CAP_CheckOverflow (void)
 Checks capacity overflows on bases. More...
 

Function Documentation

void CAP_AddCurrent ( base_t base,
baseCapacities_t  capacity,
int  value 
)

Changes the current (used) capacity on a base.

Parameters
[in,out]baseThe base to set capacity at
[in]capacityCapacity type
[in]valueCapacity to add to the current (used) capacity value (negative to decrease)

Definition at line 108 of file cp_capacity.cpp.

References base_s::capacities, and capacities_s::cur.

Referenced by AIR_Add(), AIR_Delete(), AIR_MoveAircraftIntoNewHomebase(), CAP_UpdateStorageCap(), CP_SpawnRescueMission(), E_HireEmployee(), E_MoveIntoNewBase(), RS_AssignScientist(), RS_RemoveScientist(), TR_TransferStart(), and Employee::unhire().

void CAP_AddMax ( base_t base,
baseCapacities_t  capacity,
int  value 
)

Changes the maximal capacity on a base.

Parameters
[in,out]baseThe base to set capacity at
[in]capacityCapacity type
[in]valueCapacity to add to the maximal capacity value (negative to decrease)

Definition at line 86 of file cp_capacity.cpp.

References base_s::capacities, and capacities_s::max.

Referenced by B_UpdateBaseCapacities().

int CAP_GetFreeCapacity ( const base_t base,
baseCapacities_t  capacityType 
)
void CAP_RemoveAntimatterExceedingCapacity ( base_t base)

Remove exceeding antimatter if an antimatter tank has been destroyed.

Parameters
[in]basePointer to the base.

Definition at line 38 of file cp_capacity.cpp.

References B_AddAntimatter(), CAP_ANTIMATTER, CAP_GetCurrent, and CAP_GetMax.

Referenced by B_Destroy_AntimaterStorage_f(), and CAP_CheckOverflow().

void CAP_SetCurrent ( base_t base,
baseCapacities_t  capacity,
int  value 
)

Sets the current (used) capacity on a base.

Parameters
[in,out]baseThe base to set capacity at
[in]capacityCapacity type
[in]valueNew current (used) capacity value

Definition at line 97 of file cp_capacity.cpp.

References base_s::capacities, and capacities_s::cur.

Referenced by B_Build(), B_Destroy(), B_ResetAllStatusAndCapacities(), B_UpdateAntimatterCap(), CAP_UpdateStorageCap(), and RS_RemoveScientistsExceedingCapacity().

void CAP_SetMax ( base_t base,
baseCapacities_t  capacity,
int  value 
)

Sets the maximal capacity on a base.

Parameters
[in,out]baseThe base to set capacity at
[in]capacityCapacity type
[in]valueNew maximal capacity value

Definition at line 75 of file cp_capacity.cpp.

References base_s::capacities, and capacities_s::max.

Referenced by B_UpdateBaseCapacities().

void CAP_UpdateStorageCap ( base_t base)

Update Storage Capacity.

Parameters
[in]basePointer to the base
See also
B_ResetAllStatusAndCapacities_f

Definition at line 52 of file cp_capacity.cpp.

References B_ItemInBase(), B_ItemIsStoredInBaseStorage(), CAP_AddCurrent(), CAP_ITEMS, CAP_SetCurrent(), cgi, cgame_import_s::csi, E_CountHired(), EMPL_ROBOT, i, INVSH_GetItemByIDX(), csi_s::numODs, objDef_s::size, and UGV_SIZE.

Referenced by B_InitialEquipment(), B_ResetAllStatusAndCapacities(), B_SellOrAddItems(), and CP_BaseAttackMissionDestroyBase().