CInventory

From King Arthur's Gold Wiki
Jump to: navigation, search

Represents an inventory - a container for CBlobs that is itself part of (owned by) a CBlob.


For example, it may be the inventory of a catapult containing the stone or other CBlobs that have been loaded into it.

Methods:

Method Description
getBlob

Returns a reference to the CBlob that owns this object. It is a method common to several object types that are considered 'components'.

getItemsCount

Returns the number of CBlob stacks in this inventory as an int.

getItem

Returns a reference to the CBlob at the given index in this inventory's item list.

canPutItem

Returns a a bool indicating whether or not it is possible to put the given CBlob in this inventory.

putInItem

Puts the given CBlob in this inventory. Returns true if this was successful, otherwise it returns false.

putOutItem

Removes the given a CBlob from this inventory, either by CBlob reference or by name.

RemoveItems

Removes the a given quantity of CBlobs from this inventory by name. Returns true if there were as many matching items removed as requested, otherwise false.

RemoveAll

Removes all items from this inventory.

isInInventory

Checks if the given CBlob exists in this inventory, either by CBlob reference or by name.

hasRequirements

Checks if this inventory contains the given requirements, and writes any missing requirements into a given CBitStream.

Returns true if the requirements are met, otherwise false.

TakeRequirements

Removes the requirements specified in the given CBitStream from this inventory.

MoveInventoryTo

Removes all of the CBlobs in this inventory and puts them in the given other inventory.

Returns true if all CBlobs were moved successfully, otherwise false.