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/inventorymanager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/inventorymanager.cpp') diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index bf5a7dd9d..476768b8c 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -375,8 +375,9 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame If something is wrong (source item is empty, destination is the same as source), nothing happens */ + bool did_swap = false; move_count = list_from->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