UFO: Alien Invasion
Loading...
Searching...
No Matches
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"
Include dependency graph for cp_capacity.cpp:

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.
void CAP_UpdateStorageCap (base_t *base)
 Update Storage Capacity.
void CAP_SetMax (base_t *base, baseCapacities_t capacity, int value)
 Sets the maximal capacity on a base.
void CAP_AddMax (base_t *base, baseCapacities_t capacity, int value)
 Changes the maximal capacity on a base.
void CAP_SetCurrent (base_t *base, baseCapacities_t capacity, int value)
 Sets the current (used) capacity on a base.
void CAP_AddCurrent (base_t *base, baseCapacities_t capacity, int value)
 Changes the current (used) capacity on a base.
int CAP_GetFreeCapacity (const base_t *base, baseCapacities_t capacityType)
 Returns the free capacity of a type.
void CAP_CheckOverflow (void)
 Checks capacity overflows on bases.

Function Documentation

◆ CAP_AddCurrent()

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_t::capacities, and capacities_t::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().

◆ CAP_AddMax()

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_t::capacities, and capacities_t::max.

Referenced by B_UpdateBaseCapacities().

◆ CAP_CheckOverflow()

◆ CAP_GetFreeCapacity()

◆ CAP_RemoveAntimatterExceedingCapacity()

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().

◆ CAP_SetCurrent()

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_t::capacities, and capacities_t::cur.

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

◆ CAP_SetMax()

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_t::capacities, and capacities_t::max.

Referenced by B_UpdateBaseCapacities().

◆ CAP_UpdateStorageCap()

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, E_CountHired(), EMPL_ROBOT, i, INVSH_GetItemByIDX(), objDef_t::size, and UGV_SIZE.

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