27 #define SAVE_ALIENCARGO_ITEM "cargo"
28 #define SAVE_ALIENCARGO_TEAMDEFID "teamdefid"
29 #define SAVE_ALIENCARGO_ALIVE "alive"
30 #define SAVE_ALIENCARGO_DEAD "dead"
42 if (alive == 0 && dead == 0)
46 if (item->teamDef != team)
49 if (alive + item->alive < 0)
51 if (dead + item->dead < 0)
60 if (item->alive == 0 && item->dead == 0)
61 cgi->LIST_Remove(&this->
cargo, (
void*)item);
66 if (alive < 0 || dead < 0)
71 if (
cgi->
LIST_Add(&this->cargo, (
const void*)&cargoItem,
sizeof(cargoItem))) {
93 return this->
add(team, alive, dead);
106 if (item->teamDef != team)
123 if (item->teamDef != team)
155 if (!
cgi->
LIST_Add(&listing, (
void*)item,
sizeof(*item))) {
156 cgi->LIST_Delete(&listing);
178 if (!
add(teamId, alive, dead))
179 cgi->Com_Printf(
"AlienCargo::load: Could add aliens to cargo: %s, %d, %d\n", teamId, alive, dead);
219 if (
cgi->
LIST_Add(&this->cargo, (
void*)cargoItem,
sizeof(*cargoItem))) {
221 this->
sumDead += cargoItem->dead;
224 cgi->LIST_Delete(&list);
#define SAVE_ALIENCARGO_ITEM
virtual bool add(const teamDef_t *team, int alive, int dead)
Add aliens to the cargo by teamDef.
#define SAVE_ALIENCARGO_DEAD
int getDead(void) const
Return number of all dead bodies in the cargo.
#define SAVE_ALIENCARGO_ALIVE
linkedList_t * list(void) const
Returns a copy of the cargo list.
virtual ~AlienCargo(void)
Destroys AlienCargo with it's internal data.
const cgame_import_t * cgi
AlienCargo(void)
Creates and initializes AlienCargo object.
int getAlive(void) const
Return number of all alive aliens in the cargo.
#define SAVE_ALIENCARGO_TEAMDEFID
xmlNode_t *IMPORT * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
Alien cargo class header.
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
bool load(xmlNode_t *root)
Load alien cargo from xml savegame.
xmlNode_t *IMPORT * XML_AddNode(xmlNode_t *parent, const char *name)
const teamDef_t *IMPORT * Com_GetTeamDefinitionByID(const char *team)
bool save(xmlNode_t *root) const
Save alien cargo to xml savegame.
linkedList_t *IMPORT * LIST_Add(linkedList_t **list, void const *data, size_t length)
const char *IMPORT * XML_GetString(xmlNode_t *parent, const char *name)
xmlNode_t *IMPORT * XML_GetNode(xmlNode_t *parent, const char *name)