From 6ef82982bdc813bfc5c0ed2437a1a3fa9a2242d1 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 18 Feb 2025 01:04:09 +0300 Subject: [PATCH] fix stack split (right click) with item data --- src/graphics/ui/elements/InventoryView.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graphics/ui/elements/InventoryView.cpp b/src/graphics/ui/elements/InventoryView.cpp index 3735260c..b34736a3 100644 --- a/src/graphics/ui/elements/InventoryView.cpp +++ b/src/graphics/ui/elements/InventoryView.cpp @@ -300,10 +300,11 @@ void SlotView::performRightClick(ItemStack& stack, ItemStack& grabbed) { return; if (grabbed.isEmpty()) { if (!stack.isEmpty() && layout.taking) { - grabbed.set(stack); + grabbed.set(std::move(stack)); int halfremain = stack.getCount() / 2; grabbed.setCount(stack.getCount() - halfremain); - stack.setCount(halfremain); + // reset all data in the origin slot + stack = ItemStack(stack.getItemId(), halfremain); } return; }