From c68666eb66b3d7f8aa210613e3adb73e3b835702 Mon Sep 17 00:00:00 2001 From: Cong Date: Wed, 6 Nov 2013 21:04:10 +1100 Subject: [PATCH] Fix immediate exit when pressing escape --- src/cdogs/game.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/cdogs/game.c b/src/cdogs/game.c index b12f23c8d..cad112e37 100644 --- a/src/cdogs/game.c +++ b/src/cdogs/game.c @@ -462,10 +462,6 @@ int HandleKey(int cmd, int *isPaused) JoyIsPressed(&gInputDevices.joysticks.joys[0], CMD_BUTTON4) || JoyIsPressed(&gInputDevices.joysticks.joys[1], CMD_BUTTON4)) { - if (!*isPaused) - { - *isPaused = 1; - } return 1; } else if (KeyGetPressed(&gInputDevices.keyboard)) @@ -580,9 +576,16 @@ int gameloop(void) GetPlayerCenter(&gGraphicsDevice, 1)); } is_esc_pressed = HandleKey(cmd1 | cmd2, &isPaused); - if (is_esc_pressed && isPaused) + if (is_esc_pressed) { - isDone = 1; + if (isPaused) + { + isDone = 1; + } + else + { + isPaused = 1; + } } if (!isPaused)