Skip to content

Commit

Permalink
Don't make TAB exit game if bound to inventory.
Browse files Browse the repository at this point in the history
I play with the TAB key bound to the inventory. However, the
code here assumes that TAB means "close formspec" in all contexts,
including the main menu. This causes my game to exit when I attempt
to TAB in between USERNAME and PASSWORD fields.

We know when m_client != NULL that the game is a client game and
not in the main menu, and then it's OK to use the INVENTORY bound
key to exit the formspec, since it's not the main menu.
  • Loading branch information
sofar committed Apr 18, 2017
1 parent 6120251 commit 5433e9b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/guiFormSpecMenu.cpp
Expand Up @@ -3296,8 +3296,9 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
{
if (event.EventType==EET_KEY_INPUT_EVENT) {
KeyPress kp(event.KeyInput);
if (event.KeyInput.PressedDown && ( (kp == EscapeKey) ||
(kp == getKeySetting("keymap_inventory")) || (kp == CancelKey))) {
if (event.KeyInput.PressedDown && (
(kp == EscapeKey) || (kp == CancelKey) ||
((m_client != NULL) && (kp == getKeySetting("keymap_inventory"))))) {
tryClose();
return true;
} else if (m_client != NULL && event.KeyInput.PressedDown &&
Expand Down

0 comments on commit 5433e9b

Please sign in to comment.