summaryrefslogtreecommitdiffstats
path: root/source/ItemGrid.h
diff options
context:
space:
mode:
authormadmaxoft <madmaxoft@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-03 15:56:11 +0200
committermadmaxoft <madmaxoft@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-03 15:56:11 +0200
commite27a5db409fe1d71c42235609a9fe06020b6201b (patch)
tree28376a912b0f01f89c048f7eb25becf10ceb287c /source/ItemGrid.h
parentUpdated LimitWorld. (Patch by tonibm19) (diff)
downloadcuberite-e27a5db409fe1d71c42235609a9fe06020b6201b.tar
cuberite-e27a5db409fe1d71c42235609a9fe06020b6201b.tar.gz
cuberite-e27a5db409fe1d71c42235609a9fe06020b6201b.tar.bz2
cuberite-e27a5db409fe1d71c42235609a9fe06020b6201b.tar.lz
cuberite-e27a5db409fe1d71c42235609a9fe06020b6201b.tar.xz
cuberite-e27a5db409fe1d71c42235609a9fe06020b6201b.tar.zst
cuberite-e27a5db409fe1d71c42235609a9fe06020b6201b.zip
Diffstat (limited to '')
-rw-r--r--source/ItemGrid.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/ItemGrid.h b/source/ItemGrid.h
index 6b2713c45..45f978530 100644
--- a/source/ItemGrid.h
+++ b/source/ItemGrid.h
@@ -76,18 +76,24 @@ public:
/** 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
+ if a_AllowNewStacks is set to true, empty slots can be used for the rest.
+ If a_PrioritarySlot is set to a positive value, then the corresponding slot will be used in
+ first (if empty or compatible with added items)
+ if a_PrioritarySlot is set to -1, regular order apply
Returns the number of items that fit.
*/
- int AddItem(cItem & a_ItemStack, bool a_AllowNewStacks = true);
+ int AddItem(cItem & a_ItemStack, bool a_AllowNewStacks = true, int a_PrioritarySlot = -1);
/** Same as AddItem, but works on an entire list of item stacks.
The a_ItemStackList is modified to reflect the leftover items.
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
+ if a_AllowNewStacks is set to true, empty slots can be used for the rest.
+ If a_PrioritarySlot is set to a positive value, then the corresponding slot will be used in
+ first (if empty or compatible with added items)
+ if a_PrioritarySlot is set to -1, regular order apply
Returns the total number of items that fit.
*/
- int AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks = true);
+ int AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks = true, int a_PrioritarySlot = -1);
/** 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.
@@ -160,7 +166,7 @@ public:
void RemoveListener(cListener & a_Listener);
// tolua_begin
-
+
protected:
int m_Width;
int m_Height;
@@ -173,6 +179,11 @@ protected:
/// Calls all m_Listeners for the specified slot number
void TriggerListeners(int a_SlotNum);
+
+ /** Adds up to a_Num items out of a_ItemStack, as many as can fit, in specified slot
+ Returns the number of items that did fit.
+ */
+ int AddItemToSlot(const cItem & a_ItemStack, int a_Slot, int a_Num, int a_MaxStack);
} ;
// tolua_end