summaryrefslogtreecommitdiffstats
path: root/src/Inventory.h
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
commit6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch)
tree7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/Inventory.h
parentMerge pull request #2958 from LogicParrot/fence (diff)
parentBulk clearing of whitespace (diff)
downloadcuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.zip
Diffstat (limited to 'src/Inventory.h')
-rw-r--r--src/Inventory.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/Inventory.h b/src/Inventory.h
index 5501399bd..adad2fcbb 100644
--- a/src/Inventory.h
+++ b/src/Inventory.h
@@ -36,14 +36,14 @@ class cInventory :
// tolua_begin
{
public:
-
+
// Counts and offsets to individual parts of the inventory, as used by GetSlot() / SetSlot() / HowManyCanFit():
enum
{
invArmorCount = 4,
invInventoryCount = 9 * 3,
invHotbarCount = 9,
-
+
invArmorOffset = 0,
invInventoryOffset = invArmorOffset + invArmorCount,
invHotbarOffset = invInventoryOffset + invInventoryCount,
@@ -51,11 +51,11 @@ public:
} ;
// tolua_end
-
+
cInventory(cPlayer & a_Owner);
-
+
virtual ~cInventory() {}
-
+
// tolua_begin
/** Removes all items from the entire inventory */
@@ -66,7 +66,7 @@ public:
/** Returns how many items of the specified type would fit into the slot range specified */
int HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int a_EndSlotNum, bool a_ConsiderEmptySlots);
-
+
/** Adds as many items out of a_ItemStack as can fit.
If a_AllowNewStacks is set to false, only existing stacks can be topped up;
if a_AllowNewStacks is set to true, empty slots can be used for the rest.
@@ -88,38 +88,38 @@ public:
/** Removes one item out of the currently equipped item stack, returns true if successful, false if empty-handed */
bool RemoveOneEquippedItem(void);
-
+
/** Returns the number of items of type a_Item that are stored */
int HowManyItems(const cItem & a_Item);
-
+
/** Returns true if there are at least as many items of type a_ItemStack as in a_ItemStack */
bool HasItems(const cItem & a_ItemStack);
/** Sends the equipped item slot to the client */
void SendEquippedSlot();
-
+
/** Returns the cItemGrid object representing the armor slots */
cItemGrid & GetArmorGrid(void) { return m_ArmorSlots; }
-
+
/** Returns the cItemGrid object representing the main inventory slots */
cItemGrid & GetInventoryGrid(void) { return m_InventorySlots; }
-
+
/** Returns the cItemGrid object representing the hotbar slots */
cItemGrid & GetHotbarGrid(void) { return m_HotbarSlots; }
-
+
/** Returns the player associated with this inventory */
cPlayer & GetOwner(void) { return m_Owner; }
-
+
/** Copies the non-empty slots into a_ItemStacks; preserves the original a_Items contents */
void CopyToItems(cItems & a_Items);
-
+
// tolua_end
/** Returns the player associated with this inventory (const version) */
const cPlayer & GetOwner(void) const { return m_Owner; }
-
+
// tolua_begin
-
+
const cItem & GetSlot(int a_SlotNum) const;
const cItem & GetArmorSlot(int a_ArmorSlotNum) const;
const cItem & GetInventorySlot(int a_InventorySlotNum) const;
@@ -129,29 +129,29 @@ public:
void SetArmorSlot(int a_ArmorSlotNum, const cItem & a_Item);
void SetInventorySlot(int a_InventorySlotNum, const cItem & a_Item);
void SetHotbarSlot(int a_HotBarSlotNum, const cItem & a_Item);
-
+
void SetEquippedSlotNum(int a_SlotNum);
int GetEquippedSlotNum(void) { return m_EquippedSlotNum; }
-
+
/** Adds (or subtracts, if a_AddToCount is negative) to the count of items in the specified slot.
If the slot is empty, ignores the call.
Returns the new count, or -1 if the slot number is invalid.
*/
int ChangeSlotCount(int a_SlotNum, int a_AddToCount);
-
+
/** Adds the specified damage to the specified item; deletes the item and returns true if the item broke. */
bool DamageItem(int a_SlotNum, short a_Amount);
/** Adds the specified damage to the currently held item; deletes the item and returns true if the item broke. */
bool DamageEquippedItem(short a_Amount = 1);
-
+
const cItem & GetEquippedHelmet (void) const { return m_ArmorSlots.GetSlot(0); }
const cItem & GetEquippedChestplate(void) const { return m_ArmorSlots.GetSlot(1); }
const cItem & GetEquippedLeggings (void) const { return m_ArmorSlots.GetSlot(2); }
const cItem & GetEquippedBoots (void) const { return m_ArmorSlots.GetSlot(3); }
// tolua_end
-
+
/** Sends the slot contents to the owner */
void SendSlot(int a_SlotNum);
@@ -166,7 +166,7 @@ public:
protected:
bool AddToBar(cItem & a_Item, const int a_Offset, const int a_Size, bool * a_bChangedSlots, int a_Mode = 0);
-
+
cItemGrid m_ArmorSlots;
cItemGrid m_InventorySlots;
cItemGrid m_HotbarSlots;
@@ -174,13 +174,13 @@ protected:
int m_EquippedSlotNum;
cPlayer & m_Owner;
-
+
/** Returns the ItemGrid and the (grid-local) slot number for a (global) slot number; return nullptr for invalid SlotNum */
const cItemGrid * GetGridForSlotNum(int a_SlotNum, int & a_GridSlotNum) const;
-
+
/** Returns the ItemGrid and the (grid-local) slot number for a (global) slot number; return nullptr for invalid SlotNum */
cItemGrid * GetGridForSlotNum(int a_SlotNum, int & a_GridSlotNum);
-
+
// cItemGrid::cListener override:
virtual void OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) override;
}; // tolua_export