Author: cazfi
Date: Tue Sep  8 17:27:40 2015
New Revision: 29815

URL: http://svn.gna.org/viewcvs/freeciv?rev=29815&view=rev
Log:
Made single_pole behavior server setting separate from the topology.

Reported by Edmund Usercutter

See bug #23261

Modified:
    trunk/common/map.c
    trunk/common/map.h
    trunk/server/generator/mapgen_topology.c
    trunk/server/generator/temperature_map.c
    trunk/server/settings.c

Modified: trunk/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.c?rev=29815&r1=29814&r2=29815&view=diff
==============================================================================
--- trunk/common/map.c  (original)
+++ trunk/common/map.c  Tue Sep  8 17:27:40 2015
@@ -178,6 +178,7 @@
     map.server.startpos = MAP_DEFAULT_STARTPOS;
     map.server.tinyisles = MAP_DEFAULT_TINYISLES;
     map.server.separatepoles = MAP_DEFAULT_SEPARATE_POLES;
+    map.server.single_pole = MAP_DEFAULT_SINGLE_POLE;
     map.server.alltemperate = MAP_DEFAULT_ALLTEMPERATE;
     map.server.temperature = MAP_DEFAULT_TEMPERATURE;
     map.server.have_resources = FALSE;

Modified: trunk/common/map.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.h?rev=29815&r1=29814&r2=29815&view=diff
==============================================================================
--- trunk/common/map.h  (original)
+++ trunk/common/map.h  Tue Sep  8 17:27:40 2015
@@ -98,6 +98,7 @@
       enum map_startpos startpos;
       bool tinyisles;
       bool separatepoles;
+      bool single_pole;
       bool alltemperate;
       int temperature;
       int wetness;
@@ -673,6 +674,10 @@
 #define MAP_MIN_SEPARATE_POLES       FALSE
 #define MAP_MAX_SEPARATE_POLES       TRUE
 
+#define MAP_DEFAULT_SINGLE_POLE    FALSE
+#define MAP_MIN_SINGLE_POLE        FALSE
+#define MAP_MAX_SINGLE_POLE        TRUE
+
 #define MAP_DEFAULT_ALLTEMPERATE   FALSE
 #define MAP_MIN_ALLTEMPERATE       FALSE
 #define MAP_MAX_ALLTEMPERATE       TRUE

Modified: trunk/server/generator/mapgen_topology.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/generator/mapgen_topology.c?rev=29815&r1=29814&r2=29815&view=diff
==============================================================================
--- trunk/server/generator/mapgen_topology.c    (original)
+++ trunk/server/generator/mapgen_topology.c    Tue Sep  8 17:27:40 2015
@@ -52,13 +52,15 @@
 
   index_to_map_pos(&tile_x, &tile_y, tile_index(ptile));
   do_in_natural_pos(ntl_x, ntl_y, tile_x, tile_y) {
-    if (!current_topo_has_flag(TF_WRAPX) && !current_topo_has_flag(TF_WRAPY)) {
-      /* A FLAT (unwrapped) map 
-       *
-       * We assume this is a partial planetary map.  A polar zone is placed
-       * at the top and the equator is at the bottom.  The user can specify
-       * all-temperate to avoid this. */
-      return MAX_COLATITUDE * ntl_y / (NATURAL_HEIGHT - 1);
+    if (map.server.single_pole) {
+      if (!current_topo_has_flag(TF_WRAPY)) {
+        /* Partial planetary map.  A polar zone is placed
+         * at the top and the equator is at the bottom. */
+        return MAX_COLATITUDE * ntl_y / (NATURAL_HEIGHT - 1);
+      }
+      if (!current_topo_has_flag(TF_WRAPX)) {
+        return MAX_COLATITUDE * ntl_x / (NATURAL_WIDTH -1);
+      }
     }
 
     /* Otherwise a wrapping map is assumed to be a global planetary map. */
@@ -94,12 +96,12 @@
         / (NATURAL_HEIGHT / 2 - 1));
   } do_in_natural_pos_end;
 
-  if (current_topo_has_flag(TF_WRAPX) && !current_topo_has_flag(TF_WRAPY)) {
+  if (!current_topo_has_flag(TF_WRAPY)) {
     /* In an Earth-like topology the polar zones are at north and south.
      * This is equivalent to a Mercator projection. */
     return MAX_COLATITUDE * y;
   }
-  
+
   if (!current_topo_has_flag(TF_WRAPX) && current_topo_has_flag(TF_WRAPY)) {
     /* In a Uranus-like topology the polar zones are at east and west.
      * This isn't really the way Uranus is; it's the way Earth would look
@@ -367,8 +369,10 @@
   }
 
   /* correction for single pole (Flat Earth) */
-  if (!current_topo_has_flag(TF_WRAPX) && !current_topo_has_flag(TF_WRAPY)) {
-    ice_base_colatitude /= 2;
+  if (map.server.single_pole) {
+    if (!current_topo_has_flag(TF_WRAPY) || !current_topo_has_flag(TF_WRAPX)) {
+      ice_base_colatitude /= 2;
+    }
   }
 
   map_init_topology();

Modified: trunk/server/generator/temperature_map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/generator/temperature_map.c?rev=29815&r1=29814&r2=29815&view=diff
==============================================================================
--- trunk/server/generator/temperature_map.c    (original)
+++ trunk/server/generator/temperature_map.c    Tue Sep  8 17:27:40 2015
@@ -130,7 +130,7 @@
     if (!real) {
       tmap(ptile) = t;
     } else {
-      /* hight land can be 30% cooler */
+      /* high land can be 30% cooler */
       float height = - 0.3 * MAX(0, hmap(ptile) - hmap_shore_level) 
          / (hmap_max_level - hmap_shore_level); 
       /* near ocean temperature can be 15% more "temperate" */

Modified: trunk/server/settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/settings.c?rev=29815&r1=29814&r2=29815&view=diff
==============================================================================
--- trunk/server/settings.c     (original)
+++ trunk/server/settings.c     Tue Sep  8 17:27:40 2015
@@ -1417,6 +1417,13 @@
            N_("Whether the poles are separate continents"),
            N_("If this setting is disabled, the continents may attach to "
               "poles."), NULL, NULL, MAP_DEFAULT_SEPARATE_POLES)
+
+  GEN_BOOL("singlepole", map.server.single_pole,
+           SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL, SSET_TO_CLIENT,
+           N_("Whether there's just one pole generated"),
+           N_("If this setting is enabled, only one side of the map will have "
+              "pole. This setting has no effect if the map wraps both "
+              "directions."), NULL, NULL, MAP_DEFAULT_SINGLE_POLE)
 
   GEN_BOOL("alltemperate", map.server.alltemperate, 
            SSET_MAP_GEN, SSET_GEOLOGY, SSET_RARE, SSET_TO_CLIENT,


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

Reply via email to