Author: cazfi
Date: Wed Jun 22 08:41:29 2016
New Revision: 32949

URL: http://svn.gna.org/viewcvs/freeciv?rev=32949&view=rev
Log:
Have have_resources value for current map separately from if it should be
saved as part of scenario.

See bug #24767

Modified:
    branches/S2_6/common/game.c
    branches/S2_6/common/map.c
    branches/S2_6/common/map_types.h
    branches/S2_6/server/generator/mapgen.c
    branches/S2_6/server/savegame.c
    branches/S2_6/server/savegame2.c
    branches/S2_6/server/srv_main.c

Modified: branches/S2_6/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/game.c?rev=32949&r1=32948&r2=32949&view=diff
==============================================================================
--- branches/S2_6/common/game.c (original)
+++ branches/S2_6/common/game.c Wed Jun 22 08:41:29 2016
@@ -346,7 +346,7 @@
   game.scenario.handmade = FALSE;
   game.scenario.prevent_new_cities = FALSE;
   game.scenario.lake_flooding = TRUE;
-  game.scenario.have_resources = FALSE;
+  game.scenario.have_resources = TRUE;
   game.scenario.save_random = FALSE;
   game.scenario.allow_ai_type_fallback = FALSE;
 

Modified: branches/S2_6/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map.c?rev=32949&r1=32948&r2=32949&view=diff
==============================================================================
--- branches/S2_6/common/map.c  (original)
+++ branches/S2_6/common/map.c  Wed Jun 22 08:41:29 2016
@@ -188,6 +188,7 @@
     game.map.server.alltemperate = MAP_DEFAULT_ALLTEMPERATE;
     game.map.server.temperature = MAP_DEFAULT_TEMPERATURE;
     game.map.server.have_huts = FALSE;
+    game.map.server.have_resources = FALSE;
     game.map.server.team_placement = MAP_DEFAULT_TEAM_PLACEMENT;
   }
 }

Modified: branches/S2_6/common/map_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map_types.h?rev=32949&r1=32948&r2=32949&view=diff
==============================================================================
--- branches/S2_6/common/map_types.h    (original)
+++ branches/S2_6/common/map_types.h    Wed Jun 22 08:41:29 2016
@@ -97,6 +97,7 @@
       int steepness;
       bool ocean_resources;         /* Resources in the middle of the ocean */
       bool have_huts;
+      bool have_resources;
       enum team_placement team_placement;
     } server;
 

Modified: branches/S2_6/server/generator/mapgen.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/generator/mapgen.c?rev=32949&r1=32948&r2=32949&view=diff
==============================================================================
--- branches/S2_6/server/generator/mapgen.c     (original)
+++ branches/S2_6/server/generator/mapgen.c     Wed Jun 22 08:41:29 2016
@@ -1275,8 +1275,9 @@
 
   fc_srand(game.map.server.seed);
 
-  /* don't generate tiles with mapgen==0 as we've loaded them from file */
-  /* also, don't delete (the handcrafted!) tiny islands in a scenario */
+  /* don't generate tiles with mapgen == MAPGEN_SCENARIO as we've loaded *
+     them from file.
+     Also, don't delete (the handcrafted!) tiny islands in a scenario */
   if (game.map.server.generator != MAPGEN_SCENARIO) {
     river_types_init();
 
@@ -1361,7 +1362,7 @@
   }
 
   /* some scenarios already provide specials */
-  if (!game.scenario.have_resources) {
+  if (!game.map.server.have_resources) {
     add_resources(game.map.server.riches);
   }
 
@@ -1565,7 +1566,7 @@
     }
   } whole_map_iterate_end;
 
-  game.scenario.have_resources = TRUE;
+  game.map.server.have_resources = TRUE;
 }
 
 /**************************************************************************
@@ -3692,7 +3693,7 @@
     }
   } whole_map_iterate_end;
 
-  game.scenario.have_resources = TRUE;
+  game.map.server.have_resources = TRUE;
   game.map.server.have_huts = TRUE;
 
   fair_map_destroy(pmap);

Modified: branches/S2_6/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame.c?rev=32949&r1=32948&r2=32949&view=diff
==============================================================================
--- branches/S2_6/server/savegame.c     (original)
+++ branches/S2_6/server/savegame.c     Wed Jun 22 08:41:29 2016
@@ -1134,6 +1134,7 @@
     FC_FREE(known);
   }
 
+  game.map.server.have_resources = TRUE;
   game.scenario.have_resources = TRUE;
 }
 

Modified: branches/S2_6/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame2.c?rev=32949&r1=32948&r2=32949&view=diff
==============================================================================
--- branches/S2_6/server/savegame2.c    (original)
+++ branches/S2_6/server/savegame2.c    Wed Jun 22 08:41:29 2016
@@ -3079,6 +3079,7 @@
     }
   } whole_map_iterate_end;
 
+  game.map.server.have_resources = TRUE;
   game.scenario.have_resources = TRUE;
 }
 

Modified: branches/S2_6/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=32949&r1=32948&r2=32949&view=diff
==============================================================================
--- branches/S2_6/server/srv_main.c     (original)
+++ branches/S2_6/server/srv_main.c     Wed Jun 22 08:41:29 2016
@@ -2937,10 +2937,7 @@
            * +2 */
           log_normal(_("Attempt %d/%d"), i + 2, max);
         }
-        /* One should never set this to false in scenario map that had 
resources
-         * placed. We are safe side here as map generation is retried only if 
this is
-         * not scenario map at all. */
-        game.scenario.have_resources = FALSE;
+        game.map.server.have_resources = FALSE;
 
         /* Remove old information already present in tiles */
         map_free();


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

Reply via email to