<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40767 >
2009/4/14 <>: > >> 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). Desert oil had another hack that prevented it from transferring from S2_1 savegame to TRUNK version. Updated patch attached. - ML
diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset --- freeciv/data/civ1/terrain.ruleset 2009-06-06 23:53:43.000000000 +0300 +++ freeciv/data/civ1/terrain.ruleset 2009-06-07 00:34:25.000000000 +0300 @@ -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). diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset --- freeciv/data/civ2/terrain.ruleset 2009-06-06 23:53:43.000000000 +0300 +++ freeciv/data/civ2/terrain.ruleset 2009-06-07 00:34:25.000000000 +0300 @@ -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(). diff -Nurd -X.diff_ignore freeciv/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset --- freeciv/data/default/terrain.ruleset 2009-06-06 23:53:43.000000000 +0300 +++ freeciv/data/default/terrain.ruleset 2009-06-07 00:56:11.000000000 +0300 @@ -301,7 +301,7 @@ food = 0 shield = 0 trade = 0 -resources = "resource_icy_ivory", "resource_icy_oil" +resources = "resource_icy_ivory", "resource_oil" road_trade_incr = 0 road_time = 4 irrigation_result = "no" @@ -338,7 +338,7 @@ food = 0 shield = 1 trade = 0 -resources = "resource_oasis", "resource_desert_oil" +resources = "resource_oasis", "resource_oil" road_trade_incr = 1 road_time = 2 irrigation_result = "yes" @@ -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 @@ -866,22 +849,13 @@ trade = 4 # hills-only. -[resource_icy_oil] +[resource_oil] name = _("Oil") graphic = "ts.oil" graphic_alt = "-" identifier = "x" -shield = 3 ;reduced from 4 -# glacier-only. - -[resource_desert_oil] -name = _("Oil") -graphic = "ts.oil" -graphic_alt = "-" -identifier = "X" -update22two = "P" -shield = 3 -# desert-only, special processing, see savegame map_load(). +shield = 3 ; glacier used to have 4 +# glacier, desert ; Base types: ; diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c --- freeciv/server/ruleset.c 2009-06-06 23:53:43.000000000 +0300 +++ freeciv/server/ruleset.c 2009-06-07 00:34:25.000000000 +0300 @@ -74,10 +74,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) \ @@ -1643,16 +1639,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); @@ -1953,33 +1939,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 */ diff -Nurd -X.diff_ignore freeciv/server/ruleset.h freeciv/server/ruleset.h --- freeciv/server/ruleset.h 2008-10-27 04:13:36.000000000 +0200 +++ freeciv/server/ruleset.h 2009-06-07 00:34:25.000000000 +0300 @@ -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); diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c --- freeciv/server/savegame.c 2009-06-04 23:34:41.000000000 +0300 +++ freeciv/server/savegame.c 2009-06-07 00:55:00.000000000 +0300 @@ -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); } @@ -1022,12 +997,6 @@ || NULL == ptile->terrain) { continue; } - if ('x' == ptile->resource->identifier - && 'd' == ptile->terrain->identifier - && 20199 > game.version) { - /* for compatibility with civ2 split of desert oil */ - ptile->resource = find_resource_by_identifier('X'); - } if (terrain_has_resource(ptile->terrain, ptile->resource)) { /* cannot use set_special() for internal values */ BV_SET(ptile->special, S_RESOURCE_VALID);
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev