class
#include <Spore/Simulator/cSpaceInventory.h>
cSpaceInventory
Contents
Base classes
Derived classes
- class cPlayerInventory
Public static variables
Public functions
- void func54h() virtual
- Creates 10 cargo slots.
- void SetMaxCargoAmount(int amount) virtual
- auto GetItemCount() -> size_t virtual
- auto GetItem(size_t index) -> cSpaceInventoryItem* virtual
- auto IndexOf(SpaceInventoryItemType type, const ResourceKey& id) -> int virtual
- auto GetTool(const ResourceKey& id) -> cSpaceInventoryItem* virtual
- Returns the inventory item for the given tool ID, if it is present in the current inventory.
- auto IndexOfNthItem(SpaceInventoryItemType type, size_t nth) -> int virtual
- Returns the index to the nth item of the given type in this inventory.
- auto HasItem(SpaceInventoryItemType type, uint32_t id) -> bool pure virtual
- Returns true if the inventory has an item of the given type and item instance id.
- auto HasTool(const ResourceKey& id) -> bool pure virtual
- Returns true if the inventory has the tool with the given ID (only instance id matters).
- auto RemoveItem(cSpaceInventoryItem* pItem) -> bool virtual
- auto func7Ch(size_t index, cSpaceInventoryItemPtr& dst, int count) -> bool virtual
- void AddItem(cSpaceInventoryItem* pItem, int = 0, bool = true) virtual
- Adds the given item to the inventory.
- auto GetItemByCargoSlot(cSpaceInventoryItem* pCargoSlot) -> cSpaceInventoryItem* virtual
- Returns the inventory item that uses the given cargo slot.
- auto GetCargoSlotsCount() -> size_t virtual
- Returns the total amount of cargo slots in the inventory, either used or available.
- auto GetAvailableCargoSlotsCount() -> size_t virtual
- Returns how many cargo slots are free and available to use.
- auto GetFreeCargoSlot(cSpaceInventoryItem*& pDst) -> bool virtual
- Gets the first available cargo slot item.
- void AddCargoSlots(size_t count) virtual
- Creates new empty cargo slots and adds them to the inventory.
- auto CargoSlotIsFree(cSpaceInventoryItem* pCargoSlot) -> bool virtual
- Returns true if none of the inventory items use the given item as cargo slot.
Public variables
- eastl::vector<cSpaceInventoryItemPtr> mInventoryItems
- int mMaxItemCountPerItem
Function documentation
cSpaceInventoryItem* Simulator:: cSpaceInventory:: GetTool(const ResourceKey& id) virtual
Returns the inventory item for the given tool ID, if it is present in the current inventory.
Parameters | |
---|---|
id | |
Returns | The tool inventory item (probably a cSpaceToolData), or nullptr if not in the inventory. |
int Simulator:: cSpaceInventory:: IndexOfNthItem(SpaceInventoryItemType type,
size_t nth) virtual
Returns the index to the nth item of the given type in this inventory.
Parameters | |
---|---|
type | |
nth | |
Returns | The index of the item (that can be used in GetItem()), or -1 if not present in the inventory. |
For example, nth=3 means it returns the fourth (index starts in 0!) item of the specificed type.
bool Simulator:: cSpaceInventory:: HasItem(SpaceInventoryItemType type,
uint32_t id) pure virtual
Returns true if the inventory has an item of the given type and item instance id.
Parameters | |
---|---|
type | |
id |
bool Simulator:: cSpaceInventory:: HasTool(const ResourceKey& id) pure virtual
Returns true if the inventory has the tool with the given ID (only instance id matters).
Parameters | |
---|---|
id |
Equivalent to HasItem(SpaceInventoryItemType::
.
void Simulator:: cSpaceInventory:: AddItem(cSpaceInventoryItem* pItem,
int = 0,
bool = true) virtual
Adds the given item to the inventory.
If it already exists, it returns false. If it does not exist but there is another item with the same ID (and the item is not unique), it will increase the amount (or ammo) of items with that ID.
cSpaceInventoryItem* Simulator:: cSpaceInventory:: GetItemByCargoSlot(cSpaceInventoryItem* pCargoSlot) virtual
Returns the inventory item that uses the given cargo slot.
Parameters | |
---|---|
pCargoSlot |
bool Simulator:: cSpaceInventory:: GetFreeCargoSlot(cSpaceInventoryItem*& pDst) virtual
Gets the first available cargo slot item.
Parameters | |
---|---|
pDst | |
Returns | True if pDst was written, false if there are no available cargo slots. |
Returns true if an item was written to pDst
, false if there are no available cargo slots.
void Simulator:: cSpaceInventory:: AddCargoSlots(size_t count) virtual
Creates new empty cargo slots and adds them to the inventory.
Parameters | |
---|---|
count |