summaryrefslogtreecommitdiffstats
path: root/source/ItemGrid.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-25 13:59:13 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-25 13:59:13 +0200
commitc640e9346c5e6c72b62b1beeaf5ec6de9cdc6924 (patch)
tree567565c41bab4e0fbab4eee5e3d2e647a896772c /source/ItemGrid.cpp
parentFixed the cWorld:DoWithChestAt(), DoWithDispenserAt() and DoWithFurnaceAt() callbacks binding. (diff)
downloadcuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.gz
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.bz2
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.lz
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.xz
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.tar.zst
cuberite-c640e9346c5e6c72b62b1beeaf5ec6de9cdc6924.zip
Diffstat (limited to 'source/ItemGrid.cpp')
-rw-r--r--source/ItemGrid.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/ItemGrid.cpp b/source/ItemGrid.cpp
index f1330dd56..0495105f2 100644
--- a/source/ItemGrid.cpp
+++ b/source/ItemGrid.cpp
@@ -391,6 +391,15 @@ int cItemGrid::GetFirstEmptySlot(void) const
+int cItemGrid::GetFirstUsedSlot(void) const
+{
+ return GetNextUsedSlot(-1);
+}
+
+
+
+
+
int cItemGrid::GetLastEmptySlot(void) const
{
for (int i = m_NumSlots - 1; i >= 0; i--)
@@ -407,6 +416,22 @@ int cItemGrid::GetLastEmptySlot(void) const
+int cItemGrid::GetLastUsedSlot(void) const
+{
+ for (int i = m_NumSlots - 1; i >= 0; i--)
+ {
+ if (!m_Slots[i].IsEmpty())
+ {
+ return i;
+ }
+ }
+ return -1;
+}
+
+
+
+
+
int cItemGrid::GetNextEmptySlot(int a_StartFrom) const
{
for (int i = a_StartFrom + 1; i < m_NumSlots; i++)
@@ -423,6 +448,22 @@ int cItemGrid::GetNextEmptySlot(int a_StartFrom) const
+int cItemGrid::GetNextUsedSlot(int a_StartFrom) const
+{
+ for (int i = a_StartFrom + 1; i < m_NumSlots; i++)
+ {
+ if (!m_Slots[i].IsEmpty())
+ {
+ return i;
+ }
+ }
+ return -1;
+}
+
+
+
+
+
void cItemGrid::CopyToItems(cItems & a_Items) const
{
for (int i = 0; i < m_NumSlots; i++)