-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure no item stack is being held before crafting in inventory menu #4779
Conversation
Changes to the item system are always very prone to bugs, I've learned... So better treat this PR with caution. |
Well, this doesn't really modify the item system, just the inventory menu GUI code. |
src/guiFormSpecMenu.cpp
Outdated
// 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")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This equals to !m_selected_item->isValid() || m_selected_item->listname == "craftresult"
- wouldn't that be much easier to understand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'll change it.
Mhh yeah it looks harmless. 👍 looks good but someone independent from the PR author should test it. |
Tested, it works. |
Seems a minor bug, nothing is lost if you place to inventory. |
Removing from milestone as there's much more important stuff to work on. |
src/guiFormSpecMenu.cpp
Outdated
|
||
// if there are no items selected or the selected item | ||
// belongs to craftresult list, proceed with crafting | ||
if(m_selected_item == NULL || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add missing space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay for me
it seems travis build failed on GCC6 due to unit test, i relaunch it |
@lacc97 approved so if you rebase we'll merge it immediately. |
Rebased. |
In the inventory menu, you can still click on the crafting preview to craft even if you are holding and dragging a different stack of items.
This patch fixes this by checking whether m_selected_item is either NULL or belongs to the 'craftresult' list (such that you can still easily craft multiple times by repeatedly clicking on the craft result box).