UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_capacity.h File Reference

Go to the source code of this file.

Data Structures

struct  capacities_s
 Store capacities in base. More...
 

Macros

#define CAP_Get(base, capacity)   &((base)->capacities[(capacity)])
 Capacity macros. More...
 
#define CAP_GetMax(base, capacity)   (base)->capacities[(capacity)].max
 
#define CAP_GetCurrent(base, capacity)   (base)->capacities[(capacity)].cur
 

Typedefs

typedef struct capacities_s capacities_t
 Store capacities in base. More...
 

Enumerations

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 CAP_UpdateStorageCap (struct base_s *base)
 Update Storage Capacity. More...
 
void CAP_SetMax (struct base_s *base, baseCapacities_t capacity, int value)
 Sets the maximal capacity on a base. More...
 
void CAP_AddMax (struct base_s *base, baseCapacities_t capacity, int value)
 Changes the maximal capacity on a base. More...
 
void CAP_SetCurrent (struct base_s *base, baseCapacities_t capacity, int value)
 Sets the current (used) capacity on a base. More...
 
void CAP_AddCurrent (struct base_s *base, baseCapacities_t capacity, int value)
 Changes the current (used) capacity on a base. More...
 
void CAP_RemoveAntimatterExceedingCapacity (struct base_s *base)
 Remove exceeding antimatter if an antimatter tank has been destroyed. More...
 
int CAP_GetFreeCapacity (const struct base_s *base, baseCapacities_t cap)
 
void CAP_CheckOverflow (void)
 Checks capacity overflows on bases. More...
 

Macro Definition Documentation

#define CAP_Get (   base,
  capacity 
)    &((base)->capacities[(capacity)])
#define CAP_GetCurrent (   base,
  capacity 
)    (base)->capacities[(capacity)].cur

Typedef Documentation

typedef struct capacities_s capacities_t

Store capacities in base.

Enumeration Type Documentation

All possible capacities in base.

Enumerator
CAP_ALIENS 

Live aliens stored in base.

CAP_AIRCRAFT_SMALL 

Small aircraft in base.

CAP_AIRCRAFT_BIG 

Big aircraft in base.

CAP_EMPLOYEES 

Personel in base.

CAP_ITEMS 

Items in base.

CAP_LABSPACE 

Space for scientists in laboratory.

CAP_WORKSPACE 

Space for workers in workshop.

CAP_ANTIMATTER 

Space for Antimatter Storage.

MAX_CAP 

Definition at line 27 of file cp_capacity.h.

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 struct base_s base,
baseCapacities_t  cap 
)
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().