|
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. | |
| virtual bool | add (const char *objDefId, int amount, int looseAmount) |
| Add items to the cargo by objDef Id. | |
| void | empty (void) |
| Empties the cargo. | |
| bool | isEmpty (void) const |
| Checks if the cargo is empty. | |
| itemCargo_t * | get (const objDef_t *od) const |
| Returns a cargo item by its object definition. | |
| int | getAmount (const objDef_t *od) const |
| Returns amount of an item in the cargo. | |
| int | getLooseAmount (const objDef_t *od) const |
| Returns amount of loose item in the cargo. | |
| linkedList_t * | list (void) const |
| Returns a copy of the cargo list. | |
| int | count (void) const |
| Count all items in the cargo. | |
| int | size (void) const |
| Calculate size of all items in the cargo. | |
| bool | load (xmlNode_t *root) |
| Load item cargo from xml savegame. | |
| bool | save (xmlNode_t *root) const |
| Save item cargo to xml savegame. | |
| ItemCargo (void) | |
| Creates and initializes ItemCargo object. | |
| ItemCargo (ItemCargo &itemCargo) | |
| Creates and initializes ItemCargo object from another one. | |
| virtual | ~ItemCargo (void) |
| Destroys ItemCargo with it's internal data. | |
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.
References cargo, and nullptr.
Referenced by ItemCargo().
| 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, ItemCargo(), list(), LIST_Foreach, and nullptr.
|
virtual |
Destroys ItemCargo with it's internal data.
Definition at line 257 of file itemcargo.cpp.
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().
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 add(), objDef_t::ammo, cargo, cgi, and LIST_Foreach.
Referenced by add(), add(), AII_CollectAmmo(), AII_CollectingItems(), AII_CollectItem(), load(), and TR_LoadXML().
Count all items in the cargo.
Definition at line 172 of file itemcargo.cpp.
References cargo, count(), and LIST_Foreach.
Referenced by count().
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.
Referenced by getAmount(), and getLooseAmount().
Returns amount of an item in the cargo.
| [in] | od | Object Definition pointer |
Definition at line 131 of file itemcargo.cpp.
References itemCargo_t::amount, and get().
Returns amount of loose item in the cargo.
| [in] | od | Object Definition pointer |
Definition at line 144 of file itemcargo.cpp.
References get(), and itemCargo_t::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, and LIST_Foreach.
Referenced by AII_CollectingItems(), B_SellOrAddItems(), ItemCargo(), 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, 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, 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, LIST_Foreach, and size().
Referenced by size().
|
protected |
Definition at line 43 of file itemcargo.h.
Referenced by add(), count(), empty(), get(), isEmpty(), ItemCargo(), ItemCargo(), list(), save(), size(), and ~ItemCargo().