Author: cazfi
Date: Tue Apr 28 01:49:44 2015
New Revision: 28929

URL: http://svn.gna.org/viewcvs/freeciv?rev=28929&view=rev
Log:
Save terrain / identifier mapping to the savegame. Current version of freeciv 
does not load it,
but the information exist in the savegames for the benefit of the future 
freeciv versions loading
them only.

Requested by Jacob Nevins <jtn>

See patch #6026

Modified:
    branches/S2_6/server/savegame2.c

Modified: branches/S2_6/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame2.c?rev=28929&r1=28928&r2=28929&view=diff
==============================================================================
--- branches/S2_6/server/savegame2.c    (original)
+++ branches/S2_6/server/savegame2.c    Tue Apr 28 01:49:44 2015
@@ -1706,6 +1706,8 @@
 ****************************************************************************/
 static void sg_save_savefile(struct savedata *saving)
 {
+  int i;
+
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
 
@@ -1767,8 +1769,9 @@
                      "savefile.activities_size");
   if (ACTIVITY_LAST > 0) {
     const char **modname;
-    int i = 0;
     int j;
+
+    i = 0;
 
     modname = fc_calloc(ACTIVITY_LAST, sizeof(*modname));
 
@@ -1787,8 +1790,8 @@
                      "savefile.specialists_size");
   {
     const char **modname;
-    int i = 0;
-
+
+    i = 0;
     modname = fc_calloc(specialist_count(), sizeof(*modname));
 
     specialist_type_iterate(sp) {
@@ -1825,8 +1828,8 @@
                      "savefile.extras_size");
   if (game.control.num_extra_types > 0) {
     const char **modname;
-    int i = 0;
-
+
+    i = 0;
     modname = fc_calloc(game.control.num_extra_types, sizeof(*modname));
 
     extra_type_iterate(pextra) {
@@ -1844,9 +1847,9 @@
                      "savefile.diplstate_type_size");
   if (DS_LAST > 0) {
     const char **modname;
-    int i = 0;
     int j;
 
+    i = 0;
     modname = fc_calloc(DS_LAST, sizeof(*modname));
 
     for (j = 0; j < DS_LAST; j++) {
@@ -1864,9 +1867,9 @@
                      "savefile.city_options_size");
   if (CITYO_LAST > 0) {
     const char **modname;
-    int i = 0;
     int j;
 
+    i = 0;
     modname = fc_calloc(CITYO_LAST, sizeof(*modname));
 
     for (j = 0; j < CITYO_LAST; j++) {
@@ -1878,6 +1881,17 @@
                            "savefile.city_options_vector");
     free(modname);
   }
+
+  /* Save terrain character mapping in the savegame. */
+  i = 0;
+  terrain_type_iterate(pterr) {
+    char buf[2];
+
+    secfile_insert_str(saving->file, terrain_rule_name(pterr), 
"savefile.terrident%d.name", i);
+    buf[0] = terrain_identifier(pterr);
+    buf[1] = '\0';
+    secfile_insert_str(saving->file, buf, "savefile.terrident%d.identifier", 
i++);
+  } terrain_type_iterate_end;
 }
 
 /****************************************************************************


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

Reply via email to