Author: cazfi
Date: Thu Aug 27 22:11:37 2015
New Revision: 29701

URL: http://svn.gna.org/viewcvs/freeciv?rev=29701&view=rev
Log:
Renamed savegame field "random.save" as "random.saved"

See patch #6278

Modified:
    trunk/server/savecompat.c
    trunk/server/savegame3.c

Modified: trunk/server/savecompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savecompat.c?rev=29701&r1=29700&r2=29701&view=diff
==============================================================================
--- trunk/server/savecompat.c   (original)
+++ trunk/server/savecompat.c   Thu Aug 27 22:11:37 2015
@@ -1012,10 +1012,19 @@
 ****************************************************************************/
 static void compat_load_030000(struct loaddata *loading)
 {
+  bool randsaved;
+  
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
 
   log_debug("Upgrading data from savegame to version 3.0.0");
+
+  /* Rename "random.save" as "random.saved" */
+  if (secfile_lookup_bool(loading->file, &randsaved, "random.save")) {
+    secfile_insert_bool(loading->file, randsaved, "random.saved");
+  } else {
+    log_sg("random.save: %s", secfile_error());
+  }
 }
 
 /****************************************************************************
@@ -1025,10 +1034,17 @@
 #ifdef FREECIV_DEV_SAVE_COMPAT
 static void compat_load_dev(struct loaddata *loading)
 {
+  bool randsaved;
+
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
 
   log_debug("Upgrading data between development revisions");
+
+    /* Rename "random.save" as "random.saved", if not already saved by later 
name */
+  if (secfile_lookup_bool(loading->file, &randsaved, "random.save")) {
+    secfile_insert_bool(loading->file, randsaved, "random.saved");
+  }
 }
 #endif /* FREECIV_DEV_SAVE_COMPAT */
 

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=29701&r1=29700&r2=29701&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Thu Aug 27 22:11:37 2015
@@ -2043,7 +2043,7 @@
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
 
-  if (secfile_lookup_bool_default(loading->file, FALSE, "random.save")) {
+  if (secfile_lookup_bool_default(loading->file, FALSE, "random.saved")) {
     const char *string;
     int i;
 
@@ -2066,7 +2066,7 @@
     fc_rand_set_state(loading->rstate);
   } else {
     /* No random values - mark the setting. */
-    (void) secfile_entry_by_path(loading->file, "random.save");
+    (void) secfile_entry_by_path(loading->file, "random.saved");
 
     /* We're loading a game without a seed (which is okay, if it's a scenario).
      * We need to generate the game seed now because it will be needed later
@@ -2088,7 +2088,7 @@
     int i;
     RANDOM_STATE rstate = fc_rand_state();
 
-    secfile_insert_bool(saving->file, TRUE, "random.save");
+    secfile_insert_bool(saving->file, TRUE, "random.saved");
     fc_assert(rstate.is_init);
 
     secfile_insert_int(saving->file, rstate.j, "random.index_J");
@@ -2106,7 +2106,7 @@
       secfile_insert_str(saving->file, vec, "random.table%d", i);
     }
   } else {
-    secfile_insert_bool(saving->file, FALSE, "random.save");
+    secfile_insert_bool(saving->file, FALSE, "random.saved");
   }
 }
 


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

Reply via email to