Re: [Freeciv-Dev] (PR#40767) Revert resource identifiers and remove update22* fields

2009-06-06 Thread Marko Lindqvist

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.0 +0300
+++ freeciv/data/civ1/terrain.ruleset   2009-06-07 00:34:25.0 +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.0 +0300
+++ freeciv/data/civ2/terrain.ruleset   2009-06-07 00:34:25.0 +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 = "-"
-i

[Freeciv-Dev] (PR#40767) Revert resource identifiers and remove update22* fields

2009-06-06 Thread Madeline Book

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

> [cazf...@gmail.com - Sat Jun 06 18:41:15 2009]:
> 
> 2009/4/13 Madeline Book :
> >
> >> [guest - Mon Apr 13 18:37:54 2009]:
> >>
> >> I've created and tested a rollback patch, which removes
> >> all update22* references/code and revert back resource
> >> identifiers to the 2.1.x default.
> >>
> >> - Stéphane Messerli
> >
> > 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.
> 
>  Do you want me to handle this patch, or are you going to do it soon?

If you feel like it and have time now you can do it.


---
好きにしてください。

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40767) Revert resource identifiers and remove update22* fields

2009-06-06 Thread Marko Lindqvist

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

2009/4/13 Madeline Book :
>
>> [guest - Mon Apr 13 18:37:54 2009]:
>>
>> I've created and tested a rollback patch, which removes
>> all update22* references/code and revert back resource
>> identifiers to the 2.1.x default.
>>
>> - Stéphane Messerli
>
> 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.

 Do you want me to handle this patch, or are you going to do it soon?


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40767) Revert resource identifiers and remove update22* fields

2009-04-13 Thread guest

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 changi

[Freeciv-Dev] (PR#40767) Revert resource identifiers and remove update22* fields

2009-04-13 Thread Madeline Book

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

> [guest - Mon Apr 13 18:37:54 2009]:
>
> I've created and tested a rollback patch, which removes
> all update22* references/code and revert back resource
> identifiers to the 2.1.x default.
>
> - Stéphane Messerli

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.

Thanks for doing this tedious work. :)


---
お手数をお掛けしました。

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40767) Revert resource identifiers and remove update22* fields

2009-04-13 Thread Madeline Book

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

As per discussion in #40758 I am starting a new ticket
for this issue.


---
きっちりかっちりしなさい。
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/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"