<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40767 >

> Also the terrain.ruleset files in the civ1 and civ2 ruleset
> directories need to be updated. I'll test it with recent
> and older savegames once these changes are made. Probably
> savegames already made in 2.1.99 will become incompatible,
> but that was to be expected. Hopefully this will be the
> only drawback.

I've fixed the civ1 and civ2 terrain.ruleset files too. Resource
identifiers have been rolled back to 2.1.x version.
New patch attached (contains all changes and not only the new civ1/civ2
changes).

> Thanks for doing this tedious work. :)

No problem :-)
- Stéphane Messerli

Index: server/ruleset.c
===================================================================
--- server/ruleset.c	(revision 15611)
+++ server/ruleset.c	(working copy)
@@ -69,10 +69,6 @@
 #define UNIT_CLASS_SECTION_PREFIX "unitclass_"
 #define UNIT_SECTION_PREFIX "unit_"
 
-/* savegame conversion: resource identifiers */
-char *update22one = NULL;
-char *update22two = NULL;
-
 static const char name_too_long[] = "Name \"%s\" too long; truncating.";
 #define check_name(name) (check_strlen(name, MAX_LEN_NAME, name_too_long))
 #define name_strlcpy(dst, src) \
@@ -1622,16 +1618,6 @@
   }
   game.control.resource_count = nval;
 
-  if (update22one) {
-    free(update22one);
-  }
-  update22one = fc_calloc(nval, sizeof(char));
-
-  if (update22two) {
-    free(update22two);
-  }
-  update22two = fc_calloc(nval, sizeof(char));
-
   /* avoid re-reading files */
   if (resource_sections) {
     free(resource_sections);
@@ -1932,33 +1918,6 @@
       }
     }
 
-    update22one[i]
-      = secfile_lookup_str_default(file, identifier,
-                                   "%s.update22one", rsection)[0];
-    if (RESOURCE_NULL_IDENTIFIER == update22one[i]) {
-      ruleset_error(LOG_ERROR, "\"%s\" [%s] update22one missing value.",
-                    filename, rsection);
-    }
-    if (RESOURCE_NONE_IDENTIFIER == update22one[i]) {
-      ruleset_error(LOG_ERROR,
-                    "\"%s\" [%s] cannot use '%c' as an identifier;"
-                    " it is reserved.",
-                    filename, rsection, update22one[i]);
-    }
-
-    update22two[i]
-      = secfile_lookup_str_default(file, identifier,
-                                   "%s.update22two", rsection)[0];
-    if (RESOURCE_NULL_IDENTIFIER == update22two[i]) {
-      ruleset_error(LOG_ERROR, "\"%s\" [%s] update22two missing value.",
-                    filename, rsection);
-    }
-    if (RESOURCE_NONE_IDENTIFIER == update22two[i]) {
-      ruleset_error(LOG_ERROR,
-                    "\"%s\" [%s] cannot use '%c' as an identifier;"
-                    " it is reserved.",
-                    filename, rsection, update22two[i]);
-    }
   } resource_type_iterate_end;
 
   /* base details */
Index: server/ruleset.h
===================================================================
--- server/ruleset.h	(revision 15611)
+++ server/ruleset.h	(working copy)
@@ -15,10 +15,6 @@
 
 struct conn_list;
 
-/* savegame conversion: resource identifiers */
-extern char *update22one;
-extern char *update22two;
-
 /* functions */
 void load_rulesets(void);
 void send_rulesets(struct conn_list *dest);
Index: server/savegame.c
===================================================================
--- server/savegame.c	(revision 15611)
+++ server/savegame.c	(working copy)
@@ -914,28 +914,6 @@
 }
 
 /****************************************************************************
-  Convert an older resource into the current value.
-****************************************************************************/
-static struct resource *update22_resource(char c)
-{
-  /* Different rulesets had different resources. */
-  if (strcmp(game.rulesetdir, "civ1") == 0) {
-    resource_type_iterate(presource) {
-      if (update22one[resource_index(presource)] == c) {
-        return presource;
-      }
-    } resource_type_iterate_end;
-  } else {
-    resource_type_iterate(presource) {
-      if (update22two[resource_index(presource)] == c) {
-        return presource;
-      }
-    } resource_type_iterate_end;
-  }
-  return NULL;
-}
-
-/****************************************************************************
   Return the resource for the given identifier.
 ****************************************************************************/
 static struct resource *identifier_to_resource(char c)
@@ -945,9 +923,6 @@
    || c == RESOURCE_NONE_IDENTIFIER) {
     return NULL;
   }
-  if (20199 > game.version) {
-    return update22_resource(c);
-  }
   return find_resource_by_identifier(c);
 }
 
Index: data/civ1/terrain.ruleset
===================================================================
--- data/civ1/terrain.ruleset	(revision 15611)
+++ data/civ1/terrain.ruleset	(working copy)
@@ -552,8 +552,6 @@
 ; identifier           = single-character identifier used in savegames.  This
 ;                        must be unique for each resource, and changing it will
 ;                        break savegame compatibility.
-; update22one          = single-character identifier in < 2.2 civ1 savegames.
-; update22two          = single-character identifier in < 2.2 civ2 savegames.
 ; food                 = increased food production
 ; shield               = increased shield production
 ; trade                = increased trade production
@@ -562,8 +560,7 @@
 name        = _("Gold")
 graphic     = "ts.gold"
 graphic_alt = "-"
-identifier  = "$"
-update22one = "H"
+identifier  = "H"
 trade       = 6
 # mountains.
 
@@ -572,7 +569,6 @@
 graphic     = "ts.tundra_game"
 graphic_alt = "-"
 identifier  = "A"
-update22two = "e"
 food        = 2
 # forest, tundra.
 
@@ -581,7 +577,6 @@
 graphic     = "ts.coal"
 graphic_alt = "-"
 identifier  = "C"
-update22two = "c"
 shield      = 2
 # hills.
 
@@ -590,7 +585,6 @@
 graphic     = "ts.fish"
 graphic_alt = "-"
 identifier  = "F"
-update22two = "y"
 food        = 2
 # ocean.
 
@@ -599,7 +593,6 @@
 graphic     = "ts.gems"
 graphic_alt = "-"
 identifier  = "G"
-update22two = "g"
 trade       = 4
 # jungle.
 
@@ -608,7 +601,6 @@
 graphic     = "ts.horses"
 graphic_alt = "-"
 identifier  = "I"
-update22two = "b"
 shield      = 2
 # plains (horses => buffalo => cattle).
 
@@ -617,7 +609,6 @@
 graphic     = "ts.oasis"
 graphic_alt = "-"
 identifier  = "O"
-update22two = "o"
 food        = 3
 # desert.
 
@@ -626,7 +617,6 @@
 graphic     = "ts.oil"
 graphic_alt = "-"
 identifier  = "P"
-update22two = "a"
 shield      = 4
 # swamp (petroleum => peat => petroleum).
 
@@ -635,7 +625,6 @@
 graphic     = "ts.grassland_resources"
 graphic_alt = "-"
 identifier  = "R"
-update22two = "r"
 shield      = 1
 # grassland.
 
@@ -644,7 +633,6 @@
 graphic     = "ts.seals"
 graphic_alt = "-"
 identifier  = "S"
-update22two = "i"
 food        = 2
 # arctic (seals => walrus).
 
Index: data/civ2/terrain.ruleset
===================================================================
--- data/civ2/terrain.ruleset	(revision 15611)
+++ data/civ2/terrain.ruleset	(working copy)
@@ -566,8 +566,6 @@
 ; identifier           = single-character identifier used in savegames.  This
 ;                        must be unique for each resource, and changing it will
 ;                        break savegame compatibility.
-; update22one          = single-character identifier in < 2.2 civ1 savegames.
-; update22two          = single-character identifier in < 2.2 civ2 savegames.
 ; food                 = increased food production
 ; shield               = increased shield production
 ; trade                = increased trade production
@@ -577,7 +575,6 @@
 graphic     = "ts.gold"
 graphic_alt = "-"
 identifier  = "$"
-update22one = "H"
 trade       = 6
 # mountains.
 
@@ -593,8 +590,7 @@
 name        = _("?animals:Game")
 graphic     = "ts.tundra_game"
 graphic_alt = "-"
-identifier  = "A"
-update22two = "e"
+identifier  = "e"
 food        = 2
 shield      = 1
 # tundra.
@@ -603,8 +599,7 @@
 name        = _("Furs")
 graphic     = "ts.furs"
 graphic_alt = "-"
-identifier  = "b"
-update22two = "u"
+identifier  = "u"
 food        = 1
 trade       = 3
 # tundra-only (beaver pelts).
@@ -613,8 +608,7 @@
 name        = _("Coal")
 graphic     = "ts.coal"
 graphic_alt = "-"
-identifier  = "C"
-update22two = "c"
+identifier  = "c"
 shield      = 2
 # hills.
 
@@ -626,8 +620,7 @@
 name        = _("Fish")
 graphic     = "ts.fish"
 graphic_alt = "-"
-identifier  = "F"
-update22two = "y"
+identifier  = "y"
 food        = 2
 # ocean.
 
@@ -644,8 +637,7 @@
 name        = _("Gems")
 graphic     = "ts.gems"
 graphic_alt = "-"
-identifier  = "G"
-update22two = "g"
+identifier  = "g"
 trade       = 4
 # jungle.
 
@@ -653,8 +645,7 @@
 name        = _("Buffalo")
 graphic     = "ts.buffalo"
 graphic_alt = "-"
-identifier  = "I"
-update22two = "b"
+identifier  = "b"
 shield      = 2
 # plains (horses => buffalo => cattle).
 
@@ -670,8 +661,7 @@
 name        = _("Oasis")
 graphic     = "ts.oasis"
 graphic_alt = "-"
-identifier  = "O"
-update22two = "o"
+identifier  = "o"
 food        = 3
 # desert.
 
@@ -679,8 +669,7 @@
 name        = _("Peat")
 graphic     = "ts.peat"
 graphic_alt = "-"
-identifier  = "P"
-update22two = "a"
+identifier  = "a"
 shield      = 4
 # swamp (petroleum => peat => petroleum).
 
@@ -696,8 +685,7 @@
 name        = _("Resources")
 graphic     = "ts.grassland_resources"
 graphic_alt = "-"
-identifier  = "R"
-update22two = "r"
+identifier  = "r"
 shield      = 1
 # grassland.
 
@@ -705,8 +693,7 @@
 name        = _("Ivory")
 graphic     = "ts.arctic_ivory"
 graphic_alt = "-"
-identifier  = "S"
-update22two = "i"
+identifier  = "i"
 food        = 1
 shield      = 1
 trade       = 4
@@ -758,8 +745,7 @@
 name        = _("Oil")
 graphic     = "ts.oil"
 graphic_alt = "-"
-identifier  = "X"
-update22two = "P"
+identifier  = "P"
 shield      = 3
 # desert-only, special processing, see savegame map_load().
 
Index: data/default/terrain.ruleset
===================================================================
--- data/default/terrain.ruleset	(revision 15611)
+++ data/default/terrain.ruleset	(working copy)
@@ -674,8 +674,6 @@
 ; identifier           = single-character identifier used in savegames.  This
 ;                        must be unique for each resource, and changing it will
 ;                        break savegame compatibility.
-; update22one          = single-character identifier in < 2.2 civ1 savegames.
-; update22two          = single-character identifier in < 2.2 civ2 savegames.
 ; food                 = increased food production
 ; shield               = increased shield production
 ; trade                = increased trade production
@@ -685,7 +683,6 @@
 graphic     = "ts.gold"
 graphic_alt = "-"
 identifier  = "$"
-update22one = "H"
 trade       = 6
 # glacier, hills, mountains.
 
@@ -701,8 +698,7 @@
 name        = _("?animals:Game")
 graphic     = "ts.tundra_game"
 graphic_alt = "-"
-identifier  = "A"
-update22two = "e"
+identifier  = "e"
 food        = 2
 shield      = 1
 # tundra.
@@ -711,8 +707,7 @@
 name        = _("Furs")
 graphic     = "ts.furs"
 graphic_alt = "-"
-identifier  = "b"
-update22two = "u"
+identifier  = "u"
 food        = 1
 trade       = 3
 # tundra-only (beaver pelts).
@@ -721,8 +716,7 @@
 name        = _("Coal")
 graphic     = "ts.coal"
 graphic_alt = "-"
-identifier  = "C"
-update22two = "c"
+identifier  = "c"
 shield      = 2
 # hills.
 
@@ -730,8 +724,7 @@
 name        = _("Fish")
 graphic     = "ts.fish"
 graphic_alt = "-"
-identifier  = "F"
-update22two = "y"
+identifier  = "y"
 food        = 2
 # ocean.
 
@@ -748,23 +741,17 @@
 name        = _("Gems")
 graphic     = "ts.gems"
 graphic_alt = "-"
-identifier  = "G"
-update22two = "g"
+identifier  = "g"
 trade       = 4
 # jungle.
 
 ; "h" reserved for strategic horses
 
-; "H" formerly for update22one gold
-
-; "i" reserved for incense
-
 [resource_buffalo]
 name        = _("Buffalo")
 graphic     = "ts.buffalo"
 graphic_alt = "-"
-identifier  = "I"
-update22two = "b"
+identifier  = "b"
 shield      = 2
 # plains (horses => buffalo => cattle).
 
@@ -786,8 +773,7 @@
 name        = _("Oasis")
 graphic     = "ts.oasis"
 graphic_alt = "-"
-identifier  = "O"
-update22two = "o"
+identifier  = "o"
 food        = 3
 # desert.
 
@@ -795,8 +781,7 @@
 name        = _("Peat")
 graphic     = "ts.peat"
 graphic_alt = "-"
-identifier  = "P"
-update22two = "a"
+identifier  = "a"
 shield      = 4
 # swamp (petroleum => peat => petroleum).
 
@@ -814,8 +799,7 @@
 name        = _("Resources")
 graphic     = "ts.grassland_resources"
 graphic_alt = "-"
-identifier  = "R"
-update22two = "r"
+identifier  = "r"
 shield      = 1
 # grassland.
 
@@ -823,8 +807,7 @@
 name        = _("Ivory")
 graphic     = "ts.arctic_ivory"
 graphic_alt = "-"
-identifier  = "S"
-update22two = "i"
+identifier  = "i"
 food        = 1
 shield      = 1
 trade       = 4
@@ -879,7 +862,6 @@
 graphic     = "ts.oil"
 graphic_alt = "-"
 identifier  = "X"
-update22two = "P"
 shield      = 3
 # desert-only, special processing, see savegame map_load().
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to