From: est31 Date: Wed, 19 Aug 2015 00:28:37 +0000 (+0200) Subject: Fix inventory replace bug X-Git-Tag: 0.4.13~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1fadf7f21eb5fd7a09037d92f87cd0154e9306c1;p=oweals%2Fminetest.git Fix inventory replace bug --- 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); }