UFO: Alien Invasion
Loading...
Searching...
No Matches
AlienCargo Class Reference

Alien cargo class. More...

#include <aliencargo.h>

Inheritance diagram for AlienCargo:
Inheritance graph
Collaboration diagram for AlienCargo:
Collaboration graph

Public Member Functions

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

Protected Attributes

linkedList_tcargo
int sumAlive
int sumDead

Detailed Description

Alien cargo class.

Definition at line 41 of file aliencargo.h.

Constructor & Destructor Documentation

◆ AlienCargo() [1/2]

AlienCargo::AlienCargo ( void )

Creates and initializes AlienCargo object.

Definition at line 206 of file aliencargo.cpp.

References cargo, sumAlive, and sumDead.

Referenced by AlienCargo().

◆ AlienCargo() [2/2]

AlienCargo::AlienCargo ( AlienCargo & alienCargo)

Creates and initializes AlienCargo object from another one.

Parameters
[in]alienCargoOther object to make copy of

Definition at line 214 of file aliencargo.cpp.

References AlienCargo(), cargo, cgi, list(), LIST_Foreach, sumAlive, and sumDead.

◆ ~AlienCargo()

AlienCargo::~AlienCargo ( void )
virtual

Destroys AlienCargo with it's internal data.

Definition at line 230 of file aliencargo.cpp.

References cargo, and cgi.

Member Function Documentation

◆ add() [1/2]

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

Add aliens to the cargo by team Id.

Parameters
[in]teamIdScripted Id of an alien Team
[in]aliveNumber of alive aliens
[in]deadNumber of dead aliens

Reimplemented in AlienContainment.

Definition at line 86 of file aliencargo.cpp.

References add(), and cgi.

◆ add() [2/2]

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

Add aliens to the cargo by teamDef.

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

Reimplemented in AlienContainment.

Definition at line 38 of file aliencargo.cpp.

References cargo, cgi, LIST_Foreach, sumAlive, and sumDead.

Referenced by add(), AlienContainment::add(), AL_AddAliens(), AL_AddAlienTypeToAircraftCargo(), and load().

◆ getAlive() [1/2]

int AlienCargo::getAlive ( const teamDef_t * team) const

Return number of alive aliens of a type in the cargo.

Parameters
[in]teamPointer to the alien Team Definition entry

Definition at line 100 of file aliencargo.cpp.

References cargo, and LIST_Foreach.

Referenced by AL_CountAll(), RS_RequirementsMet(), TR_Add_f(), and TR_FillAliens().

◆ getAlive() [2/2]

int AlienCargo::getAlive ( void ) const

Return number of all alive aliens in the cargo.

Definition at line 133 of file aliencargo.cpp.

References sumAlive.

Referenced by AlienContainment::add().

◆ getDead() [1/2]

int AlienCargo::getDead ( const teamDef_t * team) const

Return number of dead alien bodies of a type in the cargo.

Parameters
[in]teamPointer to the alien Team Definition entry

Definition at line 117 of file aliencargo.cpp.

References cargo, and LIST_Foreach.

Referenced by RS_RequirementsMet(), TR_Add_f(), and TR_FillAliens().

◆ getDead() [2/2]

int AlienCargo::getDead ( void ) const

Return number of all dead bodies in the cargo.

Definition at line 141 of file aliencargo.cpp.

References sumDead.

Referenced by AlienContainment::add().

◆ list()

linkedList_t * AlienCargo::list ( void ) const

Returns a copy of the cargo list.

Returns
linked list of alienCargo_t structures

Definition at line 150 of file aliencargo.cpp.

References cargo, cgi, and LIST_Foreach.

Referenced by AC_Init_f(), AC_KillAll_f(), AC_KillExceeding_f(), AC_KillOne_f(), AL_AddAliens(), AlienCargo(), TR_EmptyTransferCargo(), TR_FillAliens(), and TR_TransferStart().

◆ load()

bool AlienCargo::load ( xmlNode_t * root)

Load alien cargo from xml savegame.

Parameters
[in]rootRoot xml node to load data from

Definition at line 167 of file aliencargo.cpp.

References add(), cgi, SAVE_ALIENCARGO_ALIVE, SAVE_ALIENCARGO_DEAD, SAVE_ALIENCARGO_ITEM, SAVE_ALIENCARGO_TEAMDEFID, and xmlNode_t.

Referenced by AIR_LoadAircraftXML(), B_LoadXML(), and TR_LoadXML().

◆ save()

bool AlienCargo::save ( xmlNode_t * root) const

Save alien cargo to xml savegame.

Parameters
[out]rootRoot xml node to save data under

Definition at line 188 of file aliencargo.cpp.

References cargo, cgi, LIST_Foreach, SAVE_ALIENCARGO_ALIVE, SAVE_ALIENCARGO_DEAD, SAVE_ALIENCARGO_ITEM, SAVE_ALIENCARGO_TEAMDEFID, and xmlNode_t.

Referenced by AIR_SaveAircraftXML(), and B_SaveXML().

Field Documentation

◆ cargo

linkedList_t* AlienCargo::cargo
protected

internal linkedlist of teams and amounts

Definition at line 43 of file aliencargo.h.

Referenced by add(), AlienCargo(), AlienCargo(), getAlive(), getDead(), list(), save(), and ~AlienCargo().

◆ sumAlive

int AlienCargo::sumAlive
protected

cache of number of alive aliens of all kinds in the cargo

Definition at line 44 of file aliencargo.h.

Referenced by add(), AlienCargo(), AlienCargo(), and getAlive().

◆ sumDead

int AlienCargo::sumDead
protected

cache of number of dead bodies of all kinds in the cargo

Definition at line 45 of file aliencargo.h.

Referenced by add(), AlienCargo(), AlienCargo(), and getDead().


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