UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
aliencargo.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */
24 
25 #pragma once
26 
27 #include "cp_cgame_callbacks.h"
28 
32 typedef struct alienCargo_s {
33  const teamDef_t* teamDef;
34  int alive;
35  int dead;
36 } alienCargo_t;
37 
41 class AlienCargo {
42  protected:
44  int sumAlive;
45  int sumDead;
46  public:
47  virtual bool add (const teamDef_t* team, int alive, int dead);
48  virtual bool add (const char* teamId, int alive, int dead);
49 
50  int getAlive (const teamDef_t* team) const;
51  int getDead (const teamDef_t* team) const;
52  int getAlive (void) const;
53  int getDead (void) const;
54 
55  linkedList_t* list (void) const;
56 
57  bool load(xmlNode_t* root);
58  bool save(xmlNode_t* root) const;
59 
60  AlienCargo (void);
61  AlienCargo (AlienCargo& alienCargo);
62  virtual ~AlienCargo (void);
63 };
virtual bool add(const teamDef_t *team, int alive, int dead)
Add aliens to the cargo by teamDef.
Definition: aliencargo.cpp:38
int sumDead
Definition: aliencargo.h:45
int getDead(void) const
Return number of all dead bodies in the cargo.
Definition: aliencargo.cpp:141
linkedList_t * list(void) const
Returns a copy of the cargo list.
Definition: aliencargo.cpp:150
const teamDef_t * teamDef
Definition: aliencargo.h:33
#define xmlNode_t
Definition: xml.h:24
linkedList_t * cargo
Definition: aliencargo.h:43
virtual ~AlienCargo(void)
Destroys AlienCargo with it's internal data.
Definition: aliencargo.cpp:230
int sumAlive
Definition: aliencargo.h:44
alien cargo entry
Definition: aliencargo.h:32
Alien cargo class.
Definition: aliencargo.h:41
AlienCargo(void)
Creates and initializes AlienCargo object.
Definition: aliencargo.cpp:206
int getAlive(void) const
Return number of all alive aliens in the cargo.
Definition: aliencargo.cpp:133
bool load(xmlNode_t *root)
Load alien cargo from xml savegame.
Definition: aliencargo.cpp:167
bool save(xmlNode_t *root) const
Save alien cargo to xml savegame.
Definition: aliencargo.cpp:188
struct alienCargo_s alienCargo_t
alien cargo entry