diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-24 11:16:09 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-24 11:16:09 +0200 |
commit | 90e0656c7562fc1761fefc023df56078732da3c0 (patch) | |
tree | 9595db614f319071e7b0fe5345eb3c0e7f9171bf /source/ItemGrid.h | |
parent | Refactored cInventory to use cItemGrid for the actual Storage (diff) | |
download | cuberite-90e0656c7562fc1761fefc023df56078732da3c0.tar cuberite-90e0656c7562fc1761fefc023df56078732da3c0.tar.gz cuberite-90e0656c7562fc1761fefc023df56078732da3c0.tar.bz2 cuberite-90e0656c7562fc1761fefc023df56078732da3c0.tar.lz cuberite-90e0656c7562fc1761fefc023df56078732da3c0.tar.xz cuberite-90e0656c7562fc1761fefc023df56078732da3c0.tar.zst cuberite-90e0656c7562fc1761fefc023df56078732da3c0.zip |
Diffstat (limited to 'source/ItemGrid.h')
-rw-r--r-- | source/ItemGrid.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/ItemGrid.h b/source/ItemGrid.h index 7a2a828b1..de8be059a 100644 --- a/source/ItemGrid.h +++ b/source/ItemGrid.h @@ -42,15 +42,18 @@ public: int GetSlotNum(int a_X, int a_Y) const;
// tolua_end
+
/// Converts slot number into XY coords; sets coords to -1 on invalid slot number. Exported in ManualBindings.cpp
void GetSlotCoords(int a_SlotNum, int & a_X, int & a_Y) const;
+
+ cItem & GetSlot(int a_X, int a_Y); // TODO: This will be removed!
+ cItem & GetSlot(int a_SlotNum); // TODO: This will be removed!
+
// tolua_begin
// Retrieve slots by coords or slot number; Logs warning and returns the first slot on invalid coords / slotnum
const cItem & GetSlot(int a_X, int a_Y) const;
- cItem & GetSlot(int a_X, int a_Y);
const cItem & GetSlot(int a_SlotNum) const;
- cItem & GetSlot(int a_SlotNum);
// Set slot by coords or slot number; Logs warning and doesn't set on invalid coords / slotnum
void SetSlot(int a_X, int a_Y, const cItem & a_Item);
@@ -89,6 +92,12 @@ public: */
int ChangeSlotCount(int a_SlotNum, int a_AddToCount);
+ /** 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.
+ */
+ int ChangeSlotCount(int a_X, int a_Y, int a_AddToCount);
+
/// Returns the number of items of type a_Item that are stored
int HowManyItems(const cItem & a_Item);
@@ -110,6 +119,9 @@ public: /// Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact)
bool DamageItem(int a_SlotNum, short a_Amount);
+ /// Adds the specified damage to the specified item; returns true if the item broke (but the item is left intact)
+ bool DamageItem(int a_X, int a_Y, short a_Amount);
+
// tolua_end
|