1
0

cChestEntity and cDispenserEntity now inherit from a common ancestor, cBlockEntityWithItems

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1507 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-05-25 11:59:13 +00:00
parent e3136c2d0f
commit c640e9346c
9 changed files with 246 additions and 137 deletions

View File

@@ -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++)