From: Holger Schemel Date: Thu, 19 Apr 2018 18:37:32 +0000 (+0200) Subject: fixed changing key bindings if customization aborted by "Escape" key X-Git-Tag: 4.1.1.0~193 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=3208b9ddd1f192865fee6d0be81c8bf7283ae00f fixed changing key bindings if customization aborted by "Escape" key Before, partially changed key bindings were kept even if keyboard customization was aborted by pressing the "Escape" key during the process. Now, the old key bindings are restored in this case. --- diff --git a/src/screens.c b/src/screens.c index e6397b5c..33df999e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -6497,11 +6497,13 @@ static boolean CustomizeKeyboardMain(int player_nr) { Key key = GetEventKey((KeyEvent *)&event, FALSE); + /* press 'Escape' to abort and keep the old key bindings */ if (key == KSYM_Escape) { FadeSkipNextFadeIn(); finished = TRUE; + break; } @@ -6563,8 +6565,9 @@ static boolean CustomizeKeyboardMain(int player_nr) BackToFront(); } - /* write new key bindings back to player setup */ - setup.input[player_nr].key = custom_key; + /* write new key bindings back to player setup, if successfully finished */ + if (success) + setup.input[player_nr].key = custom_key; return success; }