From f5a4b5ca79806418b0736d3f84e9efa8d9992a34 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 18 Mar 2025 03:45:20 +0300 Subject: [PATCH] fix inventory.move_range --- src/items/Inventory.hpp | 2 +- src/logic/scripting/lua/libs/libinventory.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/items/Inventory.hpp b/src/items/Inventory.hpp index 29205640..1c66fdec 100644 --- a/src/items/Inventory.hpp +++ b/src/items/Inventory.hpp @@ -18,7 +18,7 @@ public: Inventory(int64_t id, size_t size); - Inventory(const Inventory& orig); + explicit Inventory(const Inventory& orig); ItemStack& getSlot(size_t index); size_t findEmptySlot(size_t begin = 0, size_t end = -1) const; diff --git a/src/logic/scripting/lua/libs/libinventory.cpp b/src/logic/scripting/lua/libs/libinventory.cpp index 4ae2861b..3d36d0fe 100644 --- a/src/logic/scripting/lua/libs/libinventory.cpp +++ b/src/logic/scripting/lua/libs/libinventory.cpp @@ -179,7 +179,7 @@ static int l_move_range(lua::State* L) { auto invBid = lua::tointeger(L, 3); auto slotBegin = lua::isnoneornil(L, 4) ? -1 : lua::tointeger(L, 4); auto slotEnd = lua::isnoneornil(L, 5) ? -1 : lua::tointeger(L, 5) + 1; - auto invB = get_inventory(invBid, 3); + auto& invB = get_inventory(invBid, 3); auto& slot = invA.getSlot(slotAid); if (slotBegin == -1) { invB.move(slot, *content->getIndices());