From 0dd1cd750bb51403d85a226a97a5ad93eb99b144 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 15 Jun 2017 15:32:33 +0200 Subject: BlockEntities: Support cloning self. --- src/ItemGrid.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/ItemGrid.cpp') diff --git a/src/ItemGrid.cpp b/src/ItemGrid.cpp index e97a53f68..39757e198 100644 --- a/src/ItemGrid.cpp +++ b/src/ItemGrid.cpp @@ -73,6 +73,22 @@ void cItemGrid::GetSlotCoords(int a_SlotNum, int & a_X, int & a_Y) const +void cItemGrid::CopyFrom(const cItemGrid & a_Src) +{ + ASSERT(m_Width == a_Src.m_Width); + ASSERT(m_Height == a_Src.m_Height); + for (int i = m_NumSlots - 1; i >= 0; --i) + { + m_Slots[i] = a_Src.m_Slots[i]; + } + + // The listeners are not copied +} + + + + + const cItem & cItemGrid::GetSlot(int a_X, int a_Y) const { return GetSlot(GetSlotNum(a_X, a_Y)); -- cgit v1.2.3