Difference between revisions of "CInventory"

From King Arthur's Gold Wiki
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<onlyinclude>
 
<onlyinclude>
Represents an inventory - a container for  
+
Represents an inventory - a container for [[CBlob]]s that is itself part of (owned by) a [[CBlob]].
 
</onlyinclude>
 
</onlyinclude>
 +
 +
For example, it may be the inventory of a catapult containing the stone or other [[CBlob]]s that have been loaded into it.
  
 
Methods:
 
Methods:
Line 30: Line 32:
 
| [[CInventory::RemoveItems|RemoveItems]]
 
| [[CInventory::RemoveItems|RemoveItems]]
 
| {{:CInventory::RemoveItems|RemoveItems}}
 
| {{:CInventory::RemoveItems|RemoveItems}}
 +
|-
 +
| [[CInventory::RemoveAll|RemoveAll]]
 +
| {{:CInventory::RemoveAll|RemoveAll}}
 
|-
 
|-
 
| [[CInventory::isInInventory|isInInventory]]
 
| [[CInventory::isInInventory|isInInventory]]
Line 42: Line 47:
 
| [[CInventory::MoveInventoryTo|MoveInventoryTo]]
 
| [[CInventory::MoveInventoryTo|MoveInventoryTo]]
 
| {{:CInventory::MoveInventoryTo|MoveInventoryTo}}
 
| {{:CInventory::MoveInventoryTo|MoveInventoryTo}}
|-
 
| [[CInventory::getItem|getItem]]
 
| {{:CInventory::getItem|getItem}}
 
|-
 
| [[CInventory::getItem|getItem]]
 
| {{:CInventory::getItem|getItem}}
 
|-
 
| [[CInventory::getItem|getItem]]
 
| {{:CInventory::getItem|getItem}}
 
 
|-
 
|-
 
|}
 
|}

Latest revision as of 17:38, 22 September 2012

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.