fixed changing key bindings if customization aborted by "Escape" key
[rocksndiamonds.git] / src / screens.c
index e6397b5c6532a66e33ba9a46fde9accd84837853..33df999e188698611fa0a938fe74939d8a4a8dcb 100644 (file)
@@ -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;
 }