1
0

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
This commit is contained in:
madmaxoft@gmail.com
2013-07-26 19:50:06 +00:00
parent 1b825df6c2
commit cd8720bf7e
4 changed files with 61 additions and 2 deletions

View File

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