From 1fadf7f21eb5fd7a09037d92f87cd0154e9306c1 Mon Sep 17 00:00:00 2001 From: est31 Date: Wed, 19 Aug 2015 02:28:37 +0200 Subject: Fix inventory replace bug --- src/inventory.cpp | 12 ++++++++---- src/inventory.h | 2 +- src/inventorymanager.cpp | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/inventory.cpp b/src/inventory.cpp index 6c7c8cdd1..af8b1b301 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -163,7 +163,7 @@ void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef) std::getline(is, tmp, ' '); if(!tmp.empty()) throw SerializationError("Unexpected text after item name"); - + if(name == "MaterialItem") { // Obsoleted on 2011-07-30 @@ -478,7 +478,7 @@ void InventoryList::setName(const std::string &name) void InventoryList::serialize(std::ostream &os) const { //os.imbue(std::locale("C")); - + os<<"Width "<moveItem(from_i, - list_to, to_i, count, !caused_by_move_somewhere); + list_to, to_i, count, !caused_by_move_somewhere, &did_swap); // If source is infinite, reset it's stack if (src_can_take_count == -1) { @@ -397,7 +398,7 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame } } } - if (move_count > 0) { + if (move_count > 0 || did_swap) { list_from->deleteItem(from_i); list_from->addItem(from_i, from_stack_was); } -- cgit v1.2.3