From e27a5db409fe1d71c42235609a9fe06020b6201b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 3 Jul 2013 13:56:11 +0000 Subject: Empty buckets replace fluid buckets on use and vice versa (patch contributed by Mgueydan) Fixes FS #277. API change: added an optional parameter to cItemGrid:AddItem(), cItemGrid:AddItems(), cInventory:AddItem() and cInventory:AddItems() git-svn-id: http://mc-server.googlecode.com/svn/trunk@1643 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Inventory.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/Inventory.cpp') diff --git a/source/Inventory.cpp b/source/Inventory.cpp index fc52d4621..b56f50ed7 100644 --- a/source/Inventory.cpp +++ b/source/Inventory.cpp @@ -98,7 +98,7 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int -int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks) +int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst) { cItem ToAdd(a_Item); int res = 0; @@ -112,7 +112,7 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks) } } - res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks); + res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1); ToAdd.m_ItemCount = a_Item.m_ItemCount - res; if (ToAdd.m_ItemCount == 0) { @@ -127,12 +127,12 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks) -int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks) +int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst) { int TotalAdded = 0; for (cItems::iterator itr = a_ItemStackList.begin(); itr != a_ItemStackList.end();) { - int NumAdded = AddItem(*itr, a_AllowNewStacks); + int NumAdded = AddItem(*itr, a_AllowNewStacks, a_tryToFillEquippedFirst); if (itr->m_ItemCount == NumAdded) { itr = a_ItemStackList.erase(itr); -- cgit v1.2.3