fixed displaying new high score entry if not on first page
[rocksndiamonds.git] / src / screens.c
index 95f05bf10b337eae5f82094f27ca0a2bb5d79573..39650b5cf6a4f9aa32acd0fb999518ccbd6815c1 100644 (file)
@@ -2168,10 +2168,10 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
       else if (pos == MAIN_CONTROL_EDITOR)
       {
        if (leveldir_current->readonly &&
-           !strEqual(setup.player_name, "Artsoft"))
-         Request("This level is read only!", REQ_CONFIRM);
+           setup.editor.show_read_only_warning)
+         Request("This level is read-only!", REQ_CONFIRM | REQ_STAY_OPEN);
 
-       CloseDoor(DOOR_CLOSE_2);
+       CloseDoor(DOOR_CLOSE_ALL);
 
        SetGameStatus(GAME_MODE_EDITOR);
 
@@ -4258,15 +4258,13 @@ static void HandleTypeNameExt(boolean initialize, Key key)
 
     name[xpos] = 0;
   }
-  else if (key == KSYM_Return)
+  else if (key == KSYM_Return || key == KSYM_Escape)
   {
-    setTypeNameValues(name, pos, TRUE);
+    boolean changed = (key == KSYM_Return);
 
-    active = FALSE;
-  }
-  else if (key == KSYM_Escape)
-  {
-    setTypeNameValues(name, pos, FALSE);
+    StopTextInput();
+
+    setTypeNameValues(name, pos, changed);
 
     active = FALSE;
   }
@@ -4275,8 +4273,6 @@ static void HandleTypeNameExt(boolean initialize, Key key)
 
   if (!active)
   {
-    StopTextInput();
-
     SetGameStatus(game_status_last_screen);
 
     if (game_status == GAME_MODE_MAIN)
@@ -5084,9 +5080,15 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
   if (button == MB_MENU_INITIALIZE)
   {
     level_nr = mx;
-    first_entry = 0;
     highlight_position = my;
 
+    first_entry = highlight_position - (NUM_MENU_ENTRIES_ON_SCREEN + 1) / 2 + 1;
+
+    if (first_entry < 0)
+      first_entry = 0;
+    else if (first_entry + NUM_MENU_ENTRIES_ON_SCREEN > MAX_SCORE_ENTRIES)
+      first_entry = MAX(0, MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN);
+
     drawHallOfFameList(level_nr, first_entry, highlight_position);
 
     return;
@@ -6733,6 +6735,8 @@ static struct TokenInfo setup_info_editor[] =
 #endif
   { TYPE_SWITCH, &setup.editor.show_element_token,     "Show element token:" },
   { TYPE_EMPTY,                NULL,                   ""                      },
+  { TYPE_SWITCH, &setup.editor.show_read_only_warning, "Show read-only warning:" },
+  { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
 
   { 0,                 NULL,                   NULL                    }