Skip to content

Commit 2b5341c

Browse files
lacc97SmallJoker
authored andcommittedDec 6, 2017
Ensure no item stack is being held before crafting (#4779)
1 parent fd9f195 commit 2b5341c

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed
 

Diff for: ‎src/gui/guiFormSpecMenu.cpp

+17-11
Original file line numberDiff line numberDiff line change
@@ -3668,18 +3668,24 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
36683668
a->from_i = m_selected_item->i;
36693669
m_invmgr->inventoryAction(a);
36703670
} else if (craft_amount > 0) {
3671-
m_selected_content_guess = ItemStack(); // Clear
3672-
3673-
// Send IAction::Craft
3674-
36753671
assert(s.isValid());
3676-
assert(inv_s);
3677-
3678-
infostream << "Handing IAction::Craft to manager" << std::endl;
3679-
ICraftAction *a = new ICraftAction();
3680-
a->count = craft_amount;
3681-
a->craft_inv = s.inventoryloc;
3682-
m_invmgr->inventoryAction(a);
3672+
3673+
// if there are no items selected or the selected item
3674+
// belongs to craftresult list, proceed with crafting
3675+
if (m_selected_item == NULL ||
3676+
!m_selected_item->isValid() || m_selected_item->listname == "craftresult") {
3677+
3678+
m_selected_content_guess = ItemStack(); // Clear
3679+
3680+
assert(inv_s);
3681+
3682+
// Send IACTION_CRAFT
3683+
infostream << "Handing IACTION_CRAFT to manager" << std::endl;
3684+
ICraftAction *a = new ICraftAction();
3685+
a->count = craft_amount;
3686+
a->craft_inv = s.inventoryloc;
3687+
m_invmgr->inventoryAction(a);
3688+
}
36833689
}
36843690

36853691
// If m_selected_amount has been decreased to zero, deselect

0 commit comments

Comments
 (0)
Please sign in to comment.