Fixes the shift and meta key in the hotkeys.

The test tested the right shift and meta twice and the left one never.

Issue found by cppcheck.
This commit is contained in:
Mark de Wever 2012-10-07 09:17:35 +00:00
parent e954c25637
commit 44b3dccd10
2 changed files with 8 additions and 6 deletions

View File

@ -60,6 +60,8 @@ Version 1.11.0+svn:
* Ambush now works for desert palms and dead great trees (bug #20207) * Ambush now works for desert palms and dead great trees (bug #20207)
* Hex field size and default terrain are wml configurable * Hex field size and default terrain are wml configurable
* Fix OOS when dismissing a recall in a multiplayer campaign (bug #19924). * Fix OOS when dismissing a recall in a multiplayer campaign (bug #19924).
* Fixed a bug disallowing the left shift and meta key to be detected in
the hotkeys
Version 1.11.0: Version 1.11.0:
* Add-ons client: * Add-ons client:

View File

@ -824,8 +824,8 @@ hotkey_item& get_hotkey(const SDL_JoyButtonEvent& event)
Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 *keystate = SDL_GetKeyState(NULL);
bool alt = keystate[SDLK_RALT] || keystate[SDLK_LALT]; bool alt = keystate[SDLK_RALT] || keystate[SDLK_LALT];
bool ctrl = keystate[SDLK_RCTRL] || keystate[SDLK_LCTRL]; bool ctrl = keystate[SDLK_RCTRL] || keystate[SDLK_LCTRL];
bool shift = keystate[SDLK_RSHIFT] || keystate[SDLK_RSHIFT]; bool shift = keystate[SDLK_RSHIFT] || keystate[SDLK_LSHIFT];
bool cmd = keystate[SDLK_RMETA] || keystate[SDLK_RMETA]; bool cmd = keystate[SDLK_RMETA] || keystate[SDLK_LMETA];
return get_hotkey(hotkey_item::JBUTTON, event.which, event.button, 0, shift, ctrl, alt, cmd); return get_hotkey(hotkey_item::JBUTTON, event.which, event.button, 0, shift, ctrl, alt, cmd);
} }
@ -835,8 +835,8 @@ hotkey_item& get_hotkey(const SDL_JoyHatEvent& event)
Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 *keystate = SDL_GetKeyState(NULL);
bool alt = keystate[SDLK_RALT] || keystate[SDLK_LALT]; bool alt = keystate[SDLK_RALT] || keystate[SDLK_LALT];
bool ctrl = keystate[SDLK_RCTRL] || keystate[SDLK_LCTRL]; bool ctrl = keystate[SDLK_RCTRL] || keystate[SDLK_LCTRL];
bool shift = keystate[SDLK_RSHIFT] || keystate[SDLK_RSHIFT]; bool shift = keystate[SDLK_RSHIFT] || keystate[SDLK_LSHIFT];
bool cmd = keystate[SDLK_RMETA] || keystate[SDLK_RMETA]; bool cmd = keystate[SDLK_RMETA] || keystate[SDLK_LMETA];
return get_hotkey(hotkey_item::JHAT, event.which, event.hat, event.value, shift, ctrl, alt, cmd); return get_hotkey(hotkey_item::JHAT, event.which, event.hat, event.value, shift, ctrl, alt, cmd);
} }
@ -846,8 +846,8 @@ static hotkey_item& get_hotkey(const SDL_MouseButtonEvent& event)
Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 *keystate = SDL_GetKeyState(NULL);
bool alt = keystate[SDLK_RALT] || keystate[SDLK_LALT]; bool alt = keystate[SDLK_RALT] || keystate[SDLK_LALT];
bool ctrl = keystate[SDLK_RCTRL] || keystate[SDLK_LCTRL]; bool ctrl = keystate[SDLK_RCTRL] || keystate[SDLK_LCTRL];
bool shift = keystate[SDLK_RSHIFT] || keystate[SDLK_RSHIFT]; bool shift = keystate[SDLK_RSHIFT] || keystate[SDLK_LSHIFT];
bool cmd = keystate[SDLK_RMETA] || keystate[SDLK_RMETA]; bool cmd = keystate[SDLK_RMETA] || keystate[SDLK_LMETA];
return get_hotkey(hotkey_item::MBUTTON, event.which, event.button, 0, shift, ctrl, alt, cmd); return get_hotkey(hotkey_item::MBUTTON, event.which, event.button, 0, shift, ctrl, alt, cmd);
} }