UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
itemcargo.h
Go to the documentation of this file.
1
5
6
/*
7
Copyright (C) 2002-2025 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
itemCargo_s {
33
const
objDef_t
*
objDef
;
34
int
amount
;
35
int
looseAmount
;
36
}
itemCargo_t
;
37
41
class
ItemCargo
{
42
protected
:
43
linkedList_t
*
cargo
;
44
public
:
45
virtual
bool
add
(
const
objDef_t
* od,
int
amount,
int
looseAmount);
46
virtual
bool
add
(
const
char
* objDefId,
int
amount,
int
looseAmount);
47
48
void
empty
(
void
);
49
bool
isEmpty
(
void
)
const
;
50
51
itemCargo_t
*
get
(
const
objDef_t
* od)
const
;
52
int
getAmount
(
const
objDef_t
* od)
const
;
53
int
getLooseAmount
(
const
objDef_t
* od)
const
;
54
linkedList_t
*
list
(
void
)
const
;
55
56
int
count
(
void
)
const
;
57
int
size
(
void
)
const
;
58
59
bool
load
(
xmlNode_t
* root);
60
bool
save
(
xmlNode_t
* root)
const
;
61
62
ItemCargo
(
void
);
63
ItemCargo
(
ItemCargo
& itemCargo);
64
virtual
~ItemCargo
(
void
);
65
};
ItemCargo::~ItemCargo
virtual ~ItemCargo(void)
Destroys ItemCargo with it's internal data.
Definition
itemcargo.cpp:257
ItemCargo::size
int size(void) const
Calculate size of all items in the cargo.
Definition
itemcargo.cpp:184
ItemCargo::cargo
linkedList_t * cargo
Definition
itemcargo.h:43
ItemCargo::empty
void empty(void)
Empties the cargo.
Definition
itemcargo.cpp:99
ItemCargo::load
bool load(xmlNode_t *root)
Load item cargo from xml savegame.
Definition
itemcargo.cpp:197
ItemCargo::ItemCargo
ItemCargo(void)
Creates and initializes ItemCargo object.
Definition
itemcargo.cpp:236
ItemCargo::save
bool save(xmlNode_t *root) const
Save item cargo to xml savegame.
Definition
itemcargo.cpp:218
ItemCargo::isEmpty
bool isEmpty(void) const
Checks if the cargo is empty.
Definition
itemcargo.cpp:107
ItemCargo::count
int count(void) const
Count all items in the cargo.
Definition
itemcargo.cpp:172
ItemCargo::get
itemCargo_t * get(const objDef_t *od) const
Returns a cargo item by its object definition.
Definition
itemcargo.cpp:117
ItemCargo::getLooseAmount
int getLooseAmount(const objDef_t *od) const
Returns amount of loose item in the cargo.
Definition
itemcargo.cpp:144
ItemCargo::list
linkedList_t * list(void) const
Returns a copy of the cargo list.
Definition
itemcargo.cpp:156
ItemCargo::add
virtual bool add(const objDef_t *od, int amount, int looseAmount)
Add items to the cargo.
Definition
itemcargo.cpp:39
ItemCargo::getAmount
int getAmount(const objDef_t *od) const
Returns amount of an item in the cargo.
Definition
itemcargo.cpp:131
cp_cgame_callbacks.h
itemCargo_t
item cargo entry
Definition
itemcargo.h:32
itemCargo_t::objDef
const objDef_t * objDef
Definition
itemcargo.h:33
itemCargo_t::amount
int amount
Definition
itemcargo.h:34
itemCargo_t::looseAmount
int looseAmount
Definition
itemcargo.h:35
linkedList_t
Definition
list.h:30
objDef_t
Defines all attributes of objects used in the inventory.
Definition
inv_shared.h:264
xmlNode_t
#define xmlNode_t
Definition
xml.h:24
src
client
cgame
campaign
itemcargo.h
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0