diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-26 21:50:06 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-26 21:50:06 +0200 |
commit | cd8720bf7e07c681ef90ba6159afbf53f5546ed2 (patch) | |
tree | d34f62f52260b0029b3b0948a149c539ac5fe88a /source/Inventory.cpp | |
parent | Added a shortcut for running under helgrind with the most common parameters and suppressions (diff) | |
download | cuberite-cd8720bf7e07c681ef90ba6159afbf53f5546ed2.tar cuberite-cd8720bf7e07c681ef90ba6159afbf53f5546ed2.tar.gz cuberite-cd8720bf7e07c681ef90ba6159afbf53f5546ed2.tar.bz2 cuberite-cd8720bf7e07c681ef90ba6159afbf53f5546ed2.tar.lz cuberite-cd8720bf7e07c681ef90ba6159afbf53f5546ed2.tar.xz cuberite-cd8720bf7e07c681ef90ba6159afbf53f5546ed2.tar.zst cuberite-cd8720bf7e07c681ef90ba6159afbf53f5546ed2.zip |
Diffstat (limited to 'source/Inventory.cpp')
-rw-r--r-- | source/Inventory.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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)) |