Author: cazfi
Date: Mon Apr 25 00:59:18 2016
New Revision: 32479

URL: http://svn.gna.org/viewcvs/freeciv?rev=32479&view=rev
Log:
When saving a game before map is even generated, do not save have_huts as TRUE.

See bug #24599

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

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=32479&r1=32478&r2=32479&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Mon Apr 25 00:59:18 2016
@@ -1798,6 +1798,11 @@
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
 
+  /* This defaults to TRUE even if map has not been generated. Also,
+   * old versions have also explicitly saved TRUE even in pre-game.
+   * We rely on that
+   *   1) scenario maps have it explicity right.
+   *   2) when map is actually generated, it re-initialize this to FALSE. */
   game.map.server.have_huts
     = secfile_lookup_bool_default(loading->file, TRUE, "map.have_huts");
 

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=32479&r1=32478&r2=32479&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Mon Apr 25 00:59:18 2016
@@ -2398,6 +2398,10 @@
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
 
+  /* This defaults to TRUE even if map has not been generated.
+   * We rely on that
+   *   1) scenario maps have it explicity right.
+   *   2) when map is actually generated, it re-initialize this to FALSE. */
   game.map.server.have_huts
     = secfile_lookup_bool_default(loading->file, TRUE, "map.have_huts");
 
@@ -2436,15 +2440,15 @@
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
 
+  if (map_is_empty()) {
+    /* No map. */
+    return;
+  }
+
   if (saving->scenario) {
     secfile_insert_bool(saving->file, game.map.server.have_huts, 
"map.have_huts");
   } else {
     secfile_insert_bool(saving->file, TRUE, "map.have_huts");
-  }
-
-  if (map_is_empty()) {
-    /* No map. */
-    return;
   }
 
   /* For debugging purposes only.


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

Reply via email to