From 5c38a831bf0bda271a45f143700b3fea5e6ea7ee Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 13 Jun 2013 06:13:56 +0000 Subject: cItemGrid: Added IsSlotEmpty() functions git-svn-id: http://mc-server.googlecode.com/svn/trunk@1585 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ItemGrid.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source/ItemGrid.cpp') diff --git a/source/ItemGrid.cpp b/source/ItemGrid.cpp index 5284f3ae1..c62ea6bcc 100644 --- a/source/ItemGrid.cpp +++ b/source/ItemGrid.cpp @@ -175,6 +175,31 @@ void cItemGrid::EmptySlot(int a_SlotNum) +bool cItemGrid::IsSlotEmpty(int a_SlotNum) const +{ + if ((a_SlotNum < 0) || (a_SlotNum >= m_NumSlots)) + { + LOGWARNING("%s: Invalid slot number %d out of %d slots", + __FUNCTION__, a_SlotNum, m_NumSlots + ); + return true; + } + return m_Slots[a_SlotNum].IsEmpty(); +} + + + + + +bool cItemGrid::IsSlotEmpty(int a_X, int a_Y) const +{ + return IsSlotEmpty(GetSlotNum(a_X, a_Y)); +} + + + + + void cItemGrid::Clear(void) { for (int i = 0; i < m_NumSlots; i++) -- cgit v1.2.3