Author: cazfi
Date: Sat Oct 10 20:06:52 2015
New Revision: 30042

URL: http://svn.gna.org/viewcvs/freeciv?rev=30042&view=rev
Log:
Always respect scenario.is_scenario savegame property when it's present.

See bug #23912

Modified:
    branches/S2_5/server/savegame2.c

Modified: branches/S2_5/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/savegame2.c?rev=30042&r1=30041&r2=30042&view=diff
==============================================================================
--- branches/S2_5/server/savegame2.c    (original)
+++ branches/S2_5/server/savegame2.c    Sat Oct 10 20:06:52 2015
@@ -2344,50 +2344,49 @@
   sg_check_ret();
 
   if (NULL == secfile_section_lookup(loading->file, "scenario")) {
-    /* Nothing to do. */
+    game.scenario.is_scenario = FALSE;
+
     return;
   }
 
   /* Default is that when there's scenario section (which we already checked)
    * this is a scenario. Only if it explicitly says that it's not, we consider
    * this regular savegame */
-  if (!secfile_lookup_bool_default(loading->file, TRUE, 
"scenario.is_scenario")) {
+  game.scenario.is_scenario = secfile_lookup_bool_default(loading->file, TRUE, 
"scenario.is_scenario");
+
+  if (!game.scenario.is_scenario) {
     return;
   }
 
   buf = secfile_lookup_str_default(loading->file, "", "scenario.name");
   if (buf[0] != '\0') {
-    game.scenario.is_scenario = TRUE;
     sz_strlcpy(game.scenario.name, buf);
-    buf = secfile_lookup_str_default(loading->file, "",
-                                     "scenario.description");
-    if (buf[0] != '\0') {
-      sz_strlcpy(game.scenario.description, buf);
-    } else {
-      game.scenario.description[0] = '\0';
-    }
-    game.scenario.players
-      = secfile_lookup_bool_default(loading->file, TRUE, "scenario.players");
-    game.scenario.startpos_nations
-      = secfile_lookup_bool_default(loading->file, FALSE,
-                                    "scenario.startpos_nations");
-
-    sg_failure_ret(loading->server_state == S_S_INITIAL
-                   || (loading->server_state == S_S_RUNNING
-                       && game.scenario.players == TRUE),
-                   "Invalid scenario definition (server state '%s' and "
-                   "players are %s).",
-                   server_states_name(loading->server_state),
-                   game.scenario.players ? "saved" : "not saved");
+  }
+
+  buf = secfile_lookup_str_default(loading->file, "",
+                                   "scenario.description");
+  if (buf[0] != '\0') {
+    sz_strlcpy(game.scenario.description, buf);
   } else {
-    game.scenario.is_scenario = FALSE;
-  }
-
-  if (game.scenario.is_scenario) {
-    /* Remove all defined players. They are recreated with the skill level
-     * defined by the scenario. */
-    (void) aifill(0);
-  }
+    game.scenario.description[0] = '\0';
+  }
+  game.scenario.players
+    = secfile_lookup_bool_default(loading->file, TRUE, "scenario.players");
+  game.scenario.startpos_nations
+    = secfile_lookup_bool_default(loading->file, FALSE,
+                                  "scenario.startpos_nations");
+
+  sg_failure_ret(loading->server_state == S_S_INITIAL
+                 || (loading->server_state == S_S_RUNNING
+                     && game.scenario.players == TRUE),
+                 "Invalid scenario definition (server state '%s' and "
+                 "players are %s).",
+                 server_states_name(loading->server_state),
+                 game.scenario.players ? "saved" : "not saved");
+
+  /* Remove all defined players. They are recreated with the skill level
+   * defined by the scenario. */
+  (void) aifill(0);
 }
 
 /****************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to