From 9c32e31edf7c283d939910f23b9f59edba0d2db6 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 18 Jul 2014 01:02:25 +0200 Subject: Items should first added to the first slot, not the latest. --- src/ItemGrid.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ItemGrid.cpp') diff --git a/src/ItemGrid.cpp b/src/ItemGrid.cpp index cd36b1f2a..395547545 100644 --- a/src/ItemGrid.cpp +++ b/src/ItemGrid.cpp @@ -269,7 +269,7 @@ int cItemGrid::AddItemToSlot(const cItem & a_ItemStack, int a_Slot, int a_Num, i int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_PrioritarySlot) { int NumLeft = a_ItemStack.m_ItemCount; - int MaxStack = ItemHandler(a_ItemStack.m_ItemType)->GetMaxStackSize(); + int MaxStack = a_ItemStack.GetMaxStackSize(); // Try prioritarySlot first: if ( @@ -284,7 +284,7 @@ int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_Priorit } // Scan existing stacks: - for (int i = m_NumSlots - 1; i >= 0; i--) + for (int i = 0; i < m_NumSlots; i++) { if (m_Slots[i].IsEqual(a_ItemStack)) { @@ -302,7 +302,7 @@ int cItemGrid::AddItem(cItem & a_ItemStack, bool a_AllowNewStacks, int a_Priorit return (a_ItemStack.m_ItemCount - NumLeft); } - for (int i = m_NumSlots - 1; i >= 0; i--) + for (int i = 0; i < m_NumSlots; i++) { if (m_Slots[i].IsEmpty()) { -- cgit v1.2.3