Skip to content

Commit

Permalink
Inventory: Add remaining items into the source slot directly (#14021)
Browse files Browse the repository at this point in the history
Remaining items are added into the source slot directly when left-dragging over the source slot.
  • Loading branch information
srifqi committed Dec 3, 2023
1 parent 6106e4e commit 047520d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gui/guiFormSpecMenu.cpp
Expand Up @@ -4692,6 +4692,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
// The split amount will always at least one, because the number
// of slots will never be greater than the selected amount
u16 split_amount = m_left_drag_amount / m_left_drag_stacks.size();
u16 split_remaining = m_left_drag_amount % m_left_drag_stacks.size();

ItemStack stack_from = m_left_drag_stack;
m_selected_amount = m_left_drag_amount;
Expand All @@ -4702,7 +4703,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)

if (ds.first == *m_selected_item) {
// Adding to the source stack, just change the selected amount
m_selected_amount -= split_amount;
m_selected_amount -= split_amount + split_remaining;

} else {
// Reset the stack to its original state
Expand Down

0 comments on commit 047520d

Please sign in to comment.