From 3208b9ddd1f192865fee6d0be81c8bf7283ae00f Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 19 Apr 2018 20:37:32 +0200 Subject: [PATCH] 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. --- src/screens.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; } -- 2.34.1