summaryrefslogtreecommitdiff
path: root/src/inventorymanager.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-08-19 02:28:37 +0200
committerest31 <MTest31@outlook.com>2015-08-19 03:42:00 +0200
commit1fadf7f21eb5fd7a09037d92f87cd0154e9306c1 (patch)
tree06a2557c71b7cf915660ac51a5c9142899057015 /src/inventorymanager.cpp
parentc2d23ff9ccf04dd0e4c2ba8a8026857c034bc947 (diff)
downloadminetest-1fadf7f21eb5fd7a09037d92f87cd0154e9306c1.tar.gz
minetest-1fadf7f21eb5fd7a09037d92f87cd0154e9306c1.tar.bz2
minetest-1fadf7f21eb5fd7a09037d92f87cd0154e9306c1.zip
Fix inventory replace bug
Diffstat (limited to 'src/inventorymanager.cpp')
-rw-r--r--src/inventorymanager.cpp5
1 files changed, 3 insertions, 2 deletions
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);
}