UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AlienContainment Class Reference

Alien containment class. More...

#include <aliencontainment.h>

Inherits AlienCargo.

Public Member Functions

virtual bool add (const teamDef_t *team, int alive, int dead)
 Add aliens to the containment by teamDef. More...
 
virtual bool add (const char *teamId, int alive, int dead)
 Add aliens to the containment by scripted team ID. More...
 
 AlienContainment (capacities_t *aliveCapacity, capacities_t *deadCapacity)
 Creates and initializes AlienContainment object. More...
 
virtual ~AlienContainment (void)
 Destroys AlienContainer with it's internal data. More...
 
- Public Member Functions inherited from AlienCargo
int getAlive (const teamDef_t *team) const
 Return number of alive aliens of a type in the cargo. More...
 
int getDead (const teamDef_t *team) const
 Return number of dead alien bodies of a type in the cargo. More...
 
int getAlive (void) const
 Return number of all alive aliens in the cargo. More...
 
int getDead (void) const
 Return number of all dead bodies in the cargo. More...
 
linkedList_tlist (void) const
 Returns a copy of the cargo list. More...
 
bool load (xmlNode_t *root)
 Load alien cargo from xml savegame. More...
 
bool save (xmlNode_t *root) const
 Save alien cargo to xml savegame. More...
 
 AlienCargo (void)
 Creates and initializes AlienCargo object. More...
 
 AlienCargo (AlienCargo &alienCargo)
 Creates and initializes AlienCargo object from another one. More...
 
virtual ~AlienCargo (void)
 Destroys AlienCargo with it's internal data. More...
 

Static Public Member Functions

static bool isLifeSupported (const teamDef_t *team)
 Returns if storing a specific life form is supported by the containment. More...
 
static int getCapacityNeedForAlien (const teamDef_t *teamDef, const bool isDead)
 Returns the number of capacity needed for an alien in the containment. More...
 

Protected Attributes

capacities_taliveCapacity
 
capacities_tdeadCapacity
 
- Protected Attributes inherited from AlienCargo
linkedList_tcargo
 
int sumAlive
 
int sumDead
 

Private Member Functions

void resetCurrentCapacities (void)
 Private metod to reset current capacities. More...
 

Detailed Description

Alien containment class.

Definition at line 33 of file aliencontainment.h.

Constructor & Destructor Documentation

AlienContainment::AlienContainment ( capacities_t aliveCapacity,
capacities_t deadCapacity 
)

Creates and initializes AlienContainment object.

Definition at line 129 of file aliencontainment.cpp.

References resetCurrentCapacities().

AlienContainment::~AlienContainment ( void  )
virtual

Destroys AlienContainer with it's internal data.

Definition at line 137 of file aliencontainment.cpp.

References resetCurrentCapacities().

Member Function Documentation

bool AlienContainment::add ( const teamDef_t team,
int  alive,
int  dead 
)
virtual

Add aliens to the containment by teamDef.

Parameters
[in]teamPointer to the alien Team Definition
[in]aliveNumber of alive aliens
[in]deadNumber of dead aliens

Reimplemented from AlienCargo.

Definition at line 86 of file aliencontainment.cpp.

References AlienCargo::add(), aliveCapacity, capacities_s::cur, deadCapacity, AlienCargo::getAlive(), getCapacityNeedForAlien(), AlienCargo::getDead(), isLifeSupported(), RS_GetTechForTeam(), and RS_MarkCollected().

Referenced by AC_KillAll_f(), AC_KillExceeding_f(), AC_KillOne_f(), AC_LoadXML(), add(), AL_AddAliens(), TR_EmptyTransferCargo(), and TR_TransferStart().

bool AlienContainment::add ( const char *  teamId,
int  alive,
int  dead 
)
virtual

Add aliens to the containment by scripted team ID.

Parameters
[in]teamIdScripted team ID string
[in]aliveNumber of alive aliens
[in]deadNumber of dead aliens

Reimplemented from AlienCargo.

Definition at line 116 of file aliencontainment.cpp.

References add(), cgi, and cgame_import_s::Com_GetTeamDefinitionByID().

int AlienContainment::getCapacityNeedForAlien ( const teamDef_t teamDef,
const bool  isDead 
)
static

Returns the number of capacity needed for an alien in the containment.

Parameters
[in]teamDefPointer to the alien Team Definition
[in]isDeadIf the alien to calculate for is dead

Definition at line 37 of file aliencontainment.cpp.

Referenced by AC_KillExceeding_f(), and add().

bool AlienContainment::isLifeSupported ( const teamDef_t team)
static

Returns if storing a specific life form is supported by the containment.

Parameters
[in]teamPointer to the alien Team Definition
Todo:
find a way that doesn't need a tech ID hardcoded

Definition at line 57 of file aliencontainment.cpp.

References BREATHINGAPPARATUS_TECH, CHRSH_IsTeamDefAlien(), CHRSH_IsTeamDefRobot(), RS_GetTechByID(), and RS_IsResearched_ptr().

Referenced by add(), and AL_AddAliens().

void AlienContainment::resetCurrentCapacities ( void  )
private

Private metod to reset current capacities.

Definition at line 45 of file aliencontainment.cpp.

References aliveCapacity, capacities_s::cur, and deadCapacity.

Referenced by AlienContainment(), and ~AlienContainment().

Field Documentation

capacities_t* AlienContainment::aliveCapacity
protected

Definition at line 35 of file aliencontainment.h.

Referenced by add(), and resetCurrentCapacities().

capacities_t* AlienContainment::deadCapacity
protected

Definition at line 36 of file aliencontainment.h.

Referenced by add(), and resetCurrentCapacities().


The documentation for this class was generated from the following files: