UFO: Alien Invasion
|
#include <itemcargo.h>
Public Member Functions | |
virtual bool | add (const objDef_t *od, int amount, int looseAmount) |
Add items to the cargo. More... | |
virtual bool | add (const char *objDefId, int amount, int looseAmount) |
Add items to the cargo by objDef Id. More... | |
void | empty (void) |
Empties the cargo. More... | |
bool | isEmpty (void) const |
Checks if the cargo is empty. More... | |
itemCargo_t * | get (const objDef_t *od) const |
Returns a cargo item by its object definition. More... | |
int | getAmount (const objDef_t *od) const |
Returns amount of an item in the cargo. More... | |
int | getLooseAmount (const objDef_t *od) const |
Returns amount of loose item in the cargo. More... | |
linkedList_t * | list (void) const |
Returns a copy of the cargo list. More... | |
int | count (void) const |
Count all items in the cargo. More... | |
int | size (void) const |
Calculate size of all items in the cargo. More... | |
bool | load (xmlNode_t *root) |
Load item cargo from xml savegame. More... | |
bool | save (xmlNode_t *root) const |
Save item cargo to xml savegame. More... | |
ItemCargo (void) | |
Creates and initializes ItemCargo object. More... | |
ItemCargo (ItemCargo &itemCargo) | |
Creates and initializes ItemCargo object from another one. More... | |
virtual | ~ItemCargo (void) |
Destroys ItemCargo with it's internal data. More... | |
Protected Attributes | |
linkedList_t * | cargo |
Item cargo class.
Definition at line 41 of file itemcargo.h.
ItemCargo::ItemCargo | ( | void | ) |
Creates and initializes ItemCargo object.
Definition at line 236 of file itemcargo.cpp.
ItemCargo::ItemCargo | ( | ItemCargo & | itemCargo | ) |
Creates and initializes ItemCargo object from another one.
[in] | itemCargo | Other object to make copy of |
Definition at line 244 of file itemcargo.cpp.
References cargo, cgi, list(), cgame_import_s::LIST_Add(), and LIST_Foreach.
|
virtual |
Destroys ItemCargo with it's internal data.
Definition at line 257 of file itemcargo.cpp.
Add items to the cargo.
[in] | od | Pointer to the Object Definition |
[in] | amount | Number of items to add |
[in] | looseAmount | Number of loose items to add (bullets) |
Definition at line 39 of file itemcargo.cpp.
References objDef_s::ammo, cargo, cgi, cgame_import_s::LIST_Add(), and LIST_Foreach.
Referenced by add(), AII_CollectAmmo(), AII_CollectingItems(), AII_CollectItem(), load(), TEST_F(), TR_Add_f(), and TR_LoadXML().
Add items to the cargo by objDef Id.
[in] | objDefId | Scripted Id of an object definition |
[in] | amount | Number of items to add |
[in] | looseAmount | Number of loose items to add (bullets) |
Definition at line 86 of file itemcargo.cpp.
References add(), and INVSH_GetItemByIDSilent().
Count all items in the cargo.
Definition at line 172 of file itemcargo.cpp.
References cargo, and LIST_Foreach.
Empties the cargo.
Definition at line 99 of file itemcargo.cpp.
Referenced by AII_CollectingItems(), and B_SellOrAddItems().
itemCargo_t * ItemCargo::get | ( | const objDef_t * | od | ) | const |
Returns a cargo item by its object definition.
[in] | od | Object Definition pointer |
if
no objDef cargo found Definition at line 117 of file itemcargo.cpp.
References cargo, and LIST_Foreach.
Returns amount of an item in the cargo.
[in] | od | Object Definition pointer |
Definition at line 131 of file itemcargo.cpp.
References itemCargo_s::amount.
Referenced by TR_Add_f(), and TR_FillItems().
Returns amount of loose item in the cargo.
[in] | od | Object Definition pointer |
Definition at line 144 of file itemcargo.cpp.
References itemCargo_s::looseAmount.
bool ItemCargo::isEmpty | ( | void | ) | const |
linkedList_t * ItemCargo::list | ( | void | ) | const |
Returns a copy of the cargo list.
Definition at line 156 of file itemcargo.cpp.
References cargo, cgi, cgame_import_s::LIST_Add(), and LIST_Foreach.
Referenced by AII_CollectingItems(), B_SellOrAddItems(), ItemCargo(), TR_CargoList(), TR_EmptyTransferCargo(), and TR_TransferStart().
bool ItemCargo::load | ( | xmlNode_t * | root | ) |
Load item cargo from xml savegame.
[in] | root | Root xml node to load data from |
Definition at line 197 of file itemcargo.cpp.
References add(), cgi, SAVE_ITEMCARGO_AMOUNT, SAVE_ITEMCARGO_ITEM, SAVE_ITEMCARGO_ITEMID, SAVE_ITEMCARGO_LOOSEAMOUNT, cgame_import_s::XML_GetNextNode(), cgame_import_s::XML_GetNode(), cgame_import_s::XML_GetString(), and xmlNode_t.
Referenced by AIR_LoadAircraftXML(), and TR_LoadXML().
bool ItemCargo::save | ( | xmlNode_t * | root | ) | const |
Save item cargo to xml savegame.
[out] | root | Root xml node to save data under |
Definition at line 218 of file itemcargo.cpp.
References cargo, cgi, LIST_Foreach, SAVE_ITEMCARGO_AMOUNT, SAVE_ITEMCARGO_ITEM, SAVE_ITEMCARGO_ITEMID, SAVE_ITEMCARGO_LOOSEAMOUNT, cgame_import_s::XML_AddNode(), and xmlNode_t.
Referenced by AIR_SaveAircraftXML().
Calculate size of all items in the cargo.
Definition at line 184 of file itemcargo.cpp.
References cargo, and LIST_Foreach.
Referenced by TR_DestinationCapacityList_f().
|
protected |
Definition at line 43 of file itemcargo.h.
Referenced by add(), count(), empty(), get(), isEmpty(), ItemCargo(), list(), save(), size(), and ~ItemCargo().