Author: cazfi
Date: Tue Nov 17 23:33:01 2015
New Revision: 30663

URL: http://svn.gna.org/viewcvs/freeciv?rev=30663&view=rev
Log:
Fix the way 'default' from the pre-2.5 savegames gets understood as 'classic' 
ruleset.

Sveinung Kvilhaugsvik <sveinung>

See bug #24067

Modified:
    branches/S2_6/server/savecompat.c
    branches/S2_6/server/savegame2.c

Modified: branches/S2_6/server/savecompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savecompat.c?rev=30663&r1=30662&r2=30663&view=diff
==============================================================================
--- branches/S2_6/server/savecompat.c   (original)
+++ branches/S2_6/server/savecompat.c   Tue Nov 17 23:33:01 2015
@@ -560,21 +560,11 @@
   int plrno;
   bool team_pooled_research = GAME_DEFAULT_TEAM_POOLED_RESEARCH;
   int tsize;
-  const char *rs;
 
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
 
   log_debug("Upgrading data from savegame to version 2.6.0");
-
-  rs = secfile_lookup_str_default(loading->file, GAME_DEFAULT_RULESETDIR,
-                                  "savefile.rulesetdir");
-
-  if (!strcmp("default", rs)) {
-    /* In pre-2.6 savegames 'default' rulesetdir means old name of the
-     * classic ruleset. */
-    secfile_replace_str(loading->file, "classic", "savefile.rulesetdir");
-  }
 
   /* Server setting migration. */
   {

Modified: branches/S2_6/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame2.c?rev=30663&r1=30662&r2=30663&view=diff
==============================================================================
--- branches/S2_6/server/savegame2.c    (original)
+++ branches/S2_6/server/savegame2.c    Tue Nov 17 23:33:01 2015
@@ -1548,10 +1548,18 @@
              secfile_lookup_str_default(loading->file, GAME_DEFAULT_RULESETDIR,
                                         "savefile.rulesetdir"));
   if (!strcmp("default", game.server.rulesetdir)) {
-    /* Here 'default' really means current default.
-     * Saving happens with real ruleset name, so savegames containing this
-     * are special scenarios. */
-    sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
+    int version;
+
+    version = secfile_lookup_int_default(loading->file, -1, 
"savefile.version");
+    if (version >= 30) {
+      /* Here 'default' really means current default.
+       * Saving happens with real ruleset name, so savegames containing this
+       * are special scenarios. */
+      sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
+    } else {
+      /* 'default' is the old name of the classic ruleset */
+      sz_strlcpy(game.server.rulesetdir, "classic");
+    }
   }
   if (!load_rulesets(NULL, TRUE, FALSE)) {
     /* Failed to load correct ruleset */


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

Reply via email to