summaryrefslogtreecommitdiffstats
path: root/src/Inventory.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-12-13 20:10:23 +0100
committerHowaner <franzi.moos@googlemail.com>2014-12-13 20:10:23 +0100
commita595a4a842123f10a4b27ae082794bad0250a307 (patch)
treeb0f50e06e6f7a55a8d5a18cfb37a53234f527236 /src/Inventory.cpp
parentAdded cocoa pod. (diff)
parentMerge pull request #1663 from mc-server/APIDumpSize (diff)
downloadcuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.gz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.bz2
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.lz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.xz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.zst
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.zip
Diffstat (limited to 'src/Inventory.cpp')
-rw-r--r--src/Inventory.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index 51ac32da9..fba6f4aea 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -507,7 +507,11 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
int MaxStackSize = cItemHandler::GetItemHandler(a_Item.m_ItemType)->GetMaxStackSize();
for (int i = 0; i < a_Size; i++)
{
- if (m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType && m_Slots[i + a_Offset].m_ItemCount < MaxStackSize && m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage)
+ if (
+ (m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType) &&
+ (m_Slots[i + a_Offset].m_ItemCount < MaxStackSize) &&
+ (m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage)
+ )
{
int NumFree = MaxStackSize - m_Slots[i + a_Offset].m_ItemCount;
if (NumFree >= a_Item.m_ItemCount)
@@ -533,7 +537,7 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
if (a_Mode > 0)
{
// If we got more left, find first empty slot
- for (int i = 0; i < a_Size && a_Item.m_ItemCount > 0; i++)
+ for (int i = 0; (i < a_Size) && (a_Item.m_ItemCount > 0); i++)
{
if (m_Slots[i + a_Offset].m_ItemType == -1)
{