From cd8720bf7e07c681ef90ba6159afbf53f5546ed2 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 26 Jul 2013 19:50:06 +0000 Subject: cInventory: Added the ChangeSlotCount() function to the Lua API git-svn-id: http://mc-server.googlecode.com/svn/trunk@1683 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Inventory.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source/Inventory.cpp') diff --git a/source/Inventory.cpp b/source/Inventory.cpp index b56f50ed7..74294e80e 100644 --- a/source/Inventory.cpp +++ b/source/Inventory.cpp @@ -336,6 +336,22 @@ bool cInventory::DamageEquippedItem(short a_Amount) +int cInventory::ChangeSlotCount(int a_SlotNum, int a_AddToCount) +{ + int GridSlotNum = 0; + cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); + if (Grid == NULL) + { + LOGWARNING("%s: invalid slot number, expected 0 .. %d, got %d; ignoring", __FUNCTION__, invNumSlots, a_SlotNum); + return -1; + } + return Grid->ChangeSlotCount(GridSlotNum, a_AddToCount); +} + + + + + bool cInventory::DamageItem(int a_SlotNum, short a_Amount) { if ((a_SlotNum < 0) || (a_SlotNum >= invNumSlots)) -- cgit v1.2.3