From dd010b773630776a2152d09e27d6f1e980d60400 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 10 Nov 2011 02:16:33 +0300 Subject: Fix random key press loses. --- src/game.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index e2a401d80..042bd2423 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -710,6 +710,7 @@ void Game::handleInput() if (joystick) joystick->update(); + bool wasDown(false); // Events SDL_Event event; while (SDL_PollEvent(&event)) @@ -722,6 +723,7 @@ void Game::handleInput() // Keyboard events (for discontinuous keys) if (event.type == SDL_KEYDOWN) { + wasDown = true; gcn::Window *requestedWindow = nullptr; if (setupWindow && setupWindow->isVisible() && @@ -1585,7 +1587,7 @@ void Game::handleInput() joyAttack = true; if ((((player_node->getAttackType() == 0 - && player_node->getFollow().empty()) || event.type == SDL_KEYDOWN) + && player_node->getFollow().empty()) || wasDown) || joyAttack) && mValidSpeed) { // Attacking monsters -- cgit v1.2.3-70-g09d2