Skip to content
Permalink
Browse files

Ensure no item stack is being held before crafting (#4779)

  • Loading branch information...
lacc97 authored and SmallJoker committed Dec 6, 2017
1 parent fd9f195 commit 2b5341c51864660bb1a434a520f7cca9ce3619e6
Showing with 17 additions and 11 deletions.
  1. +17 −11 src/gui/guiFormSpecMenu.cpp
@@ -3668,18 +3668,24 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
a->from_i = m_selected_item->i;
m_invmgr->inventoryAction(a);
} else if (craft_amount > 0) {
m_selected_content_guess = ItemStack(); // Clear

// Send IAction::Craft

assert(s.isValid());
assert(inv_s);

infostream << "Handing IAction::Craft to manager" << std::endl;
ICraftAction *a = new ICraftAction();
a->count = craft_amount;
a->craft_inv = s.inventoryloc;
m_invmgr->inventoryAction(a);

// if there are no items selected or the selected item
// belongs to craftresult list, proceed with crafting
if (m_selected_item == NULL ||
!m_selected_item->isValid() || m_selected_item->listname == "craftresult") {

m_selected_content_guess = ItemStack(); // Clear

assert(inv_s);

// Send IACTION_CRAFT
infostream << "Handing IACTION_CRAFT to manager" << std::endl;
ICraftAction *a = new ICraftAction();
a->count = craft_amount;
a->craft_inv = s.inventoryloc;
m_invmgr->inventoryAction(a);
}
}

// If m_selected_amount has been decreased to zero, deselect

0 comments on commit 2b5341c

Please sign in to comment.
You can’t perform that action at this time.