Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8624) New clima function to best handle terrain place,
Home

[Freeciv-Dev] (PR#8624) New clima function to best handle terrain place,

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8624) New clima function to best handle terrain place, used to place poles.
From: "Marcelo Burda" <mburda@xxxxxxxxx>
Date: Tue, 11 May 2004 14:02:59 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8624 >

He,
this file is in debug status.
LAST CHANGE
i am using the simplest function for singualrities as you proposal
IS_SINGULAR_MAP_POS(x, y ,d), when needed we can change it.( in
topologie path no there)

i am cut off make_passable. code is thinked to probably separate poles
when separatepoles flags is on. This need to be tuned

using do_in_natural_pos defined in overview code, this patch need the
overview patch (these macros and function are not included)

some bugs corrected numbering continent after a terraforming.
Marcelo
 


diff -ruN -Xdiff_ignore freeciv/common/map.c freeciv_/common/map.c
--- freeciv/common/map.c        2004-04-27 18:28:09.000000000 +0200
+++ freeciv_/common/map.c       2004-05-12 00:36:23.000000000 +0200
@@ -1547,3 +1547,4 @@
   map_distance_vector(&diff_x, &diff_y, start_x, start_y, end_x, end_y);
   return (diff_x == 0) || (diff_y == 0);
 }
+
diff -ruN -Xdiff_ignore freeciv/common/map.h freeciv_/common/map.h
--- freeciv/common/map.h        2004-05-11 18:42:50.000000000 +0200
+++ freeciv_/common/map.h       2004-05-12 00:36:36.000000000 +0200
@@ -694,4 +694,26 @@
   } do_in_native_pos_end;
 }
 
+/****************************************************************************
+  A "SINGULAR position" is any map position that have a redused number of
+ tiles in the radius of dist 
+ arg need to be normal
+****************************************************************************/
+static inline bool IS_SINGULAR_MAP_POS(int map_x, int map_y, int dist)
+{
+  CHECK_MAP_POS(map_x, map_y);
+  do_in_native_pos(nat_x, nat_y, map_x, map_y) {
+    /* HACK: An iso-map compresses the value in the X direction but not in
+     * the Y direction.  Hence (x+1,y) is 1 tile away while (x,y+2) is also
+     * one tile away. */
+    int xdist = dist, ydist = topo_has_flag(TF_ISO) ? (2 * dist) : dist;
+
+    return  (!topo_has_flag(TF_WRAPX) 
+            && (nat_x < xdist || nat_x >= map.xsize - xdist))
+           || 
+           (!topo_has_flag(TF_WRAPY)
+            && (nat_y < ydist || nat_y >= map.ysize - ydist));
+  } do_in_native_pos_end;
+}
+
 #endif  /* FC__MAP_H */
diff -ruN -Xdiff_ignore freeciv/server/mapgen.c freeciv_/server/mapgen.c
--- freeciv/server/mapgen.c     2004-04-27 18:28:18.000000000 +0200
+++ freeciv_/server/mapgen.c    2004-05-12 00:34:29.000000000 +0200
@@ -88,6 +88,93 @@
 /* this is used for generator>1 */
 #define MAP_NCONT 255
 
+/* **********************************************************************
+ * return 0 for the coolest map_x,map_y tile of the map
+ * and 100 for the hotest one, this is proportional to area climatic zones
+ * see doc/HACKING#Poles                                            [mburda]
+ *************************************************************************/ 
+
+static int map_clima(int map_x, int map_y)
+{
+  int x_2, y_2;
+  const int natural_width = NATURAL_WIDTH;
+  double x, y;
+  
+  do_in_natural_pos(ntl_x, ntl_y, map_x, map_y) {
+
+    /*
+     * Is a FLAT (unwraped) map 
+     * I asume this is a partial map of Earth, at top i place a polar zone 
+     * at bottom the ecuator one. this is a partial Earth map.
+     * flat as only one pole!
+     */
+    if (!topo_has_flag(TF_WRAPX) && !topo_has_flag(TF_WRAPY)) {
+      return 100 * ntl_y / (NATURAL_HEIGHT - 1);
+    }
+
+    /*
+     * Is a global map,
+     * firt we cut all symeties of the map to make easy get clima
+     * the map us cuted in 4 1/4
+     */
+
+    x_2 = natural_width / 2 - 1 + natural_width % 2;
+    y_2 = NATURAL_HEIGHT / 2 - 1 + NATURAL_HEIGHT % 2;
+
+    x = (double)( ntl_x > x_2 ? natural_width  - 1 - ntl_x : ntl_x) / 
(double)x_2;
+    y = (double)( ntl_y > y_2 ? NATURAL_HEIGHT - 1 - ntl_y : ntl_y) / 
(double)y_2;
+  } do_in_natural_pos_end;
+  /*
+   * classic topo 
+   * the polar zone are at N and S
+   */
+  if (topo_has_flag(TF_WRAPX) && !topo_has_flag(TF_WRAPY)) {
+    return 100 * y;
+  }
+  
+  /* Uranus topo */
+  /* poles at E and W */
+  if (!topo_has_flag(TF_WRAPX) && topo_has_flag(TF_WRAPY)) {
+    return 100 * x;
+  }
+
+  /*
+   * torus topo
+   * i make 2 circle polar zone (2 poles)
+   * Equatorial zone as the shape of a square in the map
+   */
+  
+  /* poles (N,S) and equator ( /,\) shape
+     ........
+     :N /\ N:
+     : /  \ :
+     :/ SS \:
+     :\ SS /: .....
+     : \  / :
+     :N \/ N:
+     ''''''''
+  */
+  
+  if (x + y > 1) {
+      x = 1 - x;
+      y = 1 - y;
+  }
+  return 150 * (x * x * y + x * y * y) - 50 * (x * x * x + y * y * y) +
+      150 * (x * x + y * y);
+  
+}
+
+/* ************************************************************
+ * Return TRUE if the map in a radius of 2 is  singular 
+ * This need to be best defined in future topologies works
+ * This def is ok for generalised topologies
+ * ************************************************************/
+
+static bool near_singularity(int map_x, int map_y)
+{
+  return IS_SINGULAR_MAP_POS(map_x, map_y, 2) ;
+}
+
 /**************************************************************************
   make_mountains() will convert all squares that are higher than thill to
   mountains and hills. Notice that thill will be adjusted according to
@@ -123,53 +210,36 @@
 
 /**************************************************************************
  add arctic and tundra squares in the arctic zone. 
- (that is the top 10%, and low 10% of the map)
+ (that is the coolest 10% of the map)
+ if make_polar(TRUE) we add some tundra
 **************************************************************************/
-static void make_polar(void)
+static void make_polar(bool addtundra )
 {
-  int xn, yn;
-
-  for (yn = 0; yn < map.ysize / 10; yn++) {
-    for (xn = 0; xn < map.xsize; xn++) {
-      if ((hnat(xn, yn) + (map.ysize / 10 - yn * 25) > myrand(maxval)
-          && nat_get_terrain(xn, yn) == T_GRASSLAND) || yn == 0) { 
-       if (yn < 2) {
-         nat_set_terrain(xn, yn, T_ARCTIC);
-       } else {
-         nat_set_terrain(xn, yn, T_TUNDRA);
-       }
-      } 
-    }
-  }
-  for (yn = map.ysize * 9 / 10; yn < map.ysize; yn++) {
-    for (xn = 0; xn < map.xsize; xn++) {
-      if (((hnat(xn, yn) + (map.ysize / 10 - (map.ysize - yn - 1) * 25)
-           > myrand(maxval))
-          && nat_get_terrain(xn, yn) == T_GRASSLAND)
-         || yn == map.ysize - 1) {
-       if (yn > map.ysize - 3) {
-         nat_set_terrain(xn, yn, T_ARCTIC);
-       } else {
-         nat_set_terrain(xn, yn, T_TUNDRA);
+  int T;
+  struct tile *ptile;
+  whole_map_iterate(map_x, map_y) {
+    T = map_clima(map_x, map_y);       /* temperature parameter */
+    ptile = map_get_tile(map_x, map_y);
+    if (T < 5) {               /* get the 10% coldest part of the map */
+      ptile->terrain = T_ARCTIC;
+    } else if (T <= 8) {
+      if (ptile->terrain == T_OCEAN) {
+       ptile->terrain = T_ARCTIC;
+      } else {
+       ptile->terrain = T_TUNDRA;
+      }
+    } else if (T <= 10) {
+      if (ptile->terrain == T_OCEAN) {
+       if (myrand(10) > 5) {
+         ptile->terrain = T_ARCTIC;
+       } else if (addtundra && myrand(10) > 4) {
+         ptile->terrain = T_TUNDRA;
        }
+      } else if (myrand(10) > 5) {
+       ptile->terrain = T_TUNDRA;
       }
     }
-  }
-
-  /* only arctic and tundra allowed at the poles (first and last two lines,
-     as defined in make_passable() ), to be consistent with generator>1. 
-     turn every land tile on the second lines that is not arctic into tundra,
-     since the first lines has already been set to all arctic above. */
-  for (xn = 0; xn < map.xsize; xn++) {
-    if (nat_get_terrain(xn, 1) != T_ARCTIC
-       && !is_ocean(nat_get_terrain(xn, 1))) {
-      nat_set_terrain(xn, 1, T_TUNDRA);
-    }
-    if (nat_get_terrain(xn, map.ysize - 2) != T_ARCTIC
-       && !is_ocean(nat_get_terrain(xn, map.ysize - 2))) {
-      nat_set_terrain(xn, map.ysize - 2, T_TUNDRA);
-    }
-  }
+  } whole_map_iterate_end;
 }
 
 /**************************************************************************
@@ -561,8 +631,10 @@
            x, y);
 
     /* Test if the river is done. */
-    if (adjacent_river_tiles4(x, y) != 0||
-       adjacent_ocean_tiles4(x, y) != 0) {
+    if (adjacent_river_tiles4(x, y) != 0 ||
+       adjacent_ocean_tiles4(x, y) != 0 ||
+        (map_get_terrain(x, y) == T_ARCTIC 
+         && map_clima(x, y) < 8)) { /*rivers end at poles */
       freelog(LOG_DEBUG,
              "The river ended at (%d, %d).\n", x, y);
       return TRUE;
@@ -678,7 +750,7 @@
      * 1000 rather than the current 100 */
     10 *
     /* The size of the map (poles don't count). */
-    (map_num_tiles() - 2 * map.xsize) *
+    (map_num_tiles() * 0.9) *
     /* Rivers need to be on land only. */
     map.landpercent /
     /* Adjustment value. Tested by me. Gives no rivers with 'set
@@ -799,40 +871,6 @@
   } whole_map_iterate_end;
 }
 
-/**************************************************************************
-  we want the map to be sailable east-west at least at north and south pole 
-  and make it a bit jagged at the edge as well.
-  So this procedure converts the second line and the second last line to
-  ocean, and 50% of the 3rd and 3rd last line to ocean. 
-**************************************************************************/
-static void make_passable(void)
-{
-  int x;
-  
-  for (x=0;x<map.xsize;x++) {
-    nat_set_terrain(x, 2, T_OCEAN);
-
-    /* Iso-maps need two lines of ocean. */
-    if (myrand(2) != 0 || topo_has_flag(TF_ISO)) {
-      nat_set_terrain(x, 1, T_OCEAN);
-    }
-
-    if (myrand(2) != 0) {
-      nat_set_terrain(x, 3, T_OCEAN);
-    }
-
-    nat_set_terrain(x, map.ysize - 3, T_OCEAN);
-
-    if (myrand(2) != 0 || topo_has_flag(TF_ISO)) {
-      nat_set_terrain(x, map.ysize - 2, T_OCEAN);
-    }
-    if (myrand(2) != 0) {
-      nat_set_terrain(x, map.ysize - 4, T_OCEAN);
-    }
-  } 
-  
-}
-
 /****************************************************************************
   Return TRUE if the terrain at the given map position is "clean".  This
   means that all the terrain for 2 squares around it is either grassland or
@@ -901,16 +939,14 @@
       tres*=9;
     tres/=10;
   } while (abs(total-count)> maxval/40);
-  if (map.separatepoles && has_poles) {
-    make_passable();
-  }
+
   make_mountains(maxval*8/10);
   make_forests();
   make_swamps();
   make_deserts();
   make_plains();
   if (has_poles) {
-    make_polar();
+    make_polar(FALSE);
   }
   make_fair();
   make_rivers();
@@ -974,6 +1010,46 @@
 }
 
 /**************************************************************************
+ Assign continent numbers to Poles in gen 2,3 or 4. and clean its!
+ (poles are separates island)
+ Numbers 1 and 2 are reserved for polar continents if
+ map.generator != 0; otherwise are not special.
+ Also sets map.num_continents (note 0 is ocean)
+ See the doc/HACKING#Poles
+**************************************************************************/
+
+static void assign_poles_numbers(void)
+{
+  /* Default poles, cilinder(classic or uranus) topology */
+  int x1 = 0, y1 = 0, x2 = NATIVE_WIDTH - 1, y2 = NATIVE_HEIGHT - 1;
+
+  map.num_continents = 2;
+
+  /* FLAT TOPOLOGIE (single pole)*/
+  if (!topo_has_flag(TF_WRAPX) && !topo_has_flag(TF_WRAPY) ) {
+    map.num_continents = 1;
+  }
+
+  if (topo_has_flag(TF_WRAPX) && topo_has_flag(TF_WRAPY)) {
+    /* TORUS TOPOLOGY */
+    x2 /= 2;
+    y2 /= 2;
+  }
+
+  /* set the poles */
+  if (map.generator != 0 && has_poles) {
+    do_in_map_pos(mx1, my1, x1, y1) {
+      assign_continent_flood(mx1, my1, 1);
+    } do_in_map_pos_end;
+    if (map.num_continents == 2) {
+      do_in_map_pos(mx2, my2, x2, y2) {
+       assign_continent_flood(mx2, my2, 2);
+      } do_in_map_pos_end;
+    }
+  }
+}
+
+/**************************************************************************
  Assign continent numbers to all tiles.
  Numbers 1 and 2 are reserved for polar continents if
  map.generator != 0; otherwise are not special.
@@ -984,34 +1060,21 @@
 **************************************************************************/
 void assign_continent_numbers(void)
 {
-  int isle = 1;
-
   whole_map_iterate(x, y) {
     map_set_continent(x, y, 0);
   } whole_map_iterate_end;
 
-  if (map.generator != 0 && has_poles) {
-    do_in_map_pos(x, y, 0, 0) {
-      assign_continent_flood(x, y, 1);
-    } do_in_map_pos_end;
+  assign_poles_numbers();
 
-    do_in_map_pos(x, y, 0, map.ysize - 1) {
-      assign_continent_flood(x, y, 2);
-    } do_in_map_pos_end;
-    isle = 3;
-  }
-      
   whole_map_iterate(x, y) {
     if (map_get_continent(x, y) == 0 
         && !is_ocean(map_get_terrain(x, y))) {
-      assign_continent_flood(x, y, isle++);
+      assign_continent_flood(x, y, ++map.num_continents);
     }
   } whole_map_iterate_end;
-  map.num_continents = isle-1;
 
   freelog(LOG_VERBOSE, "Map has %d continents", map.num_continents);
 }
-
 /****************************************************************************
   Return an approximation of the goodness of a tile to a civilization.
 ****************************************************************************/
@@ -1293,12 +1356,8 @@
 
   mysrand(map.seed);
 
-  /* FIXME: currently the lack of poles is hard-coded for maps that wrap
-   * north-south.  In the future this could be a server option.  It also
-   * needs to control the temperature gradient between "poles" and
-   * "equator"; e.g., if there are no poles desert and tundra should be
-   * equally likely at either end. */
-  has_poles = !topo_has_flag(TF_WRAPY);
+  has_poles = TRUE; /* fixed all maps has poles [mburda], this option
+                      can be used for a all-temperate map*/
 
   /* 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 */
@@ -1363,6 +1422,10 @@
 {
   whole_map_iterate(x, y) {
     hmap(x, y) -= minval;
+    
+    if(near_singularity(x, y)) {
+      hmap(x, y) = 0;
+    }
   } whole_map_iterate_end;
 }
 
@@ -1383,7 +1446,11 @@
     int x, y;
 
     rand_map_pos(&x, &y);
-    hmap(x, y) += myrand(5000);
+    if(near_singularity(x, y)) { /* avoid land in singularities */
+      hmap(x, y) -= myrand(5000);
+    } else if (map_clima(x, y) > 6) { /* avoid height land at poles */
+      hmap(x, y) += myrand(5000);
+    }
     if ((i % 100) == 0) {
       smooth_map(); 
     }
@@ -1798,7 +1865,8 @@
   while (i > 0 && tries-->0) {
     get_random_map_position_from_state(&x, &y, pstate);
     map_to_native_pos(&xn, &yn, x, y);
-    if (hmap(x, y) == 0 && count_card_adjc_elevated_tiles(x, y) > 0) {
+    if ((!near_singularity(x, y) || myrand(50) < 25 ) 
+      && hmap(x, y) == 0 && count_card_adjc_elevated_tiles(x, y) > 0) {
       hmap(x, y) = 1;
       i--;
       if (yn >= pstate->s - 1 && pstate->s < map.ysize - 2) {
@@ -1968,11 +2036,10 @@
 **************************************************************************/
 static void initworld(struct gen234_state *pstate)
 {
-  int xn;
-  
   height_map = fc_malloc(sizeof(int) * map.ysize * map.xsize);
   islands = fc_malloc((MAP_NCONT+1)*sizeof(struct isledata));
 
+  map.num_continents = 0;
   whole_map_iterate(x, y) {
     map_set_terrain(x, y, T_OCEAN);
     map_set_continent(x, y, 0);
@@ -1980,31 +2047,15 @@
     map_set_owner(x, y, NULL);
   } whole_map_iterate_end;
   if (has_poles) {
-    for (xn = 0; xn < map.xsize; xn++) {
-      do_in_map_pos(x, y, xn, 0) {
-       map_set_terrain(x, y, myrand(9) > 0 ? T_ARCTIC : T_TUNDRA);
-       map_set_continent(x, y, 1);
-      } do_in_map_pos_end;
-      if (myrand(9) == 0) {
-       do_in_map_pos(x, y, xn, 1) {
-         map_set_terrain(x, y, myrand(9) > 0 ? T_TUNDRA : T_ARCTIC);
-         map_set_continent(x, y, 1);
-       } do_in_map_pos_end;
-      }
-      do_in_map_pos(x, y, xn, map.ysize - 1) {
-       map_set_terrain(x, y, myrand(9) > 0 ? T_ARCTIC : T_TUNDRA);
-       map_set_continent(x, y, 2);
-      } do_in_map_pos_end;
-      if (myrand(9) == 0) {
-       do_in_map_pos(x, y, xn, map.ysize - 2) {
-         map_set_terrain(x, y, myrand(9) > 0 ? T_TUNDRA : T_ARCTIC);
-         map_set_continent(x, y, 2);
-       } do_in_map_pos_end;
+    make_polar(TRUE);
+    assign_poles_numbers(); /* this set map.num_continents to 1 or 2 too */
+    /* clean no in poles continent island */
+    whole_map_iterate(mx, my) {
+      if (map_get_continent(mx, my) == 0
+         && !is_ocean(map_get_terrain(mx, my))) {
+       map_set_terrain(mx, my, T_OCEAN);
       }
-    }
-    map.num_continents = 2;
-  } else {
-    map.num_continents = 0;
+    } whole_map_iterate_end;
   }
   make_island(0, 0, pstate, 0);
   islands[2].starters = 0;
@@ -2284,29 +2335,27 @@
 
   /* set midpoints of sides to avg of side's vertices plus a random factor */
   /* unset points are zero, don't reset if set */
-  if (hnat((x0 + x1) / 2, y0) == 0) {
-    hnat((x0 + x1) / 2, y0)
-      = (val[0][0] + val[1][0]) / 2 + myrand(step) - step / 2;
-  }
-  if (hnat((x0 + x1) /2, y1wrap) == 0) {
-    hnat((x0 + x1) / 2, y1wrap)
-      = (val[0][1] + val[1][1]) / 2 + myrand(step) - step / 2;
-  }
-  if (hnat(x0, (y0 + y1) / 2) == 0) {
-    hnat(x0, (y0 + y1) / 2)
-      = (val[0][0] + val[0][1]) / 2 + myrand(step) - step / 2;
-  }
-  if (hnat(x1wrap, (y0 + y1) / 2) == 0) {
-    hnat(x1wrap, (y0 + y1) / 2)
-      = (val[1][0] + val[1][1]) / 2 + myrand(step) - step / 2;
-  }
+#define set_midpoints(X,Y,V)                                              \
+  do_in_map_pos(map_x, map_y, (X), (Y)) {                               \
+    if( !near_singularity( map_x, map_y) && hnat((X), (Y)) == 0 ) {       \
+      hnat((X), (Y)) = V; }                                               \
+  } do_in_map_pos_end;
+
+  set_midpoints((x0 + x1)/2, y0,
+               (val[0][0] + val[1][0])/2 + myrand(step) - step/2);
+  set_midpoints((x0 + x1)/2,  y1wrap,
+               (val[0][1] + val[1][1])/2 + myrand(step) - step/2);
+  set_midpoints(x0,  (y0 + y1)/2,
+               (val[0][0] + val[0][1])/2 + myrand(step) - step/2);  
+  set_midpoints(x1wrap,  (y0 + y1)/2,
+               (val[1][0] + val[1][1])/2 + myrand(step) - step/2);  
+
 
   /* set middle to average of midpoints plus a random factor, if not set */
-  if (hnat((x0 + x1) / 2, (y0 + y1) / 2) == 0) {
-    hnat((x0 + x1) / 2, (y0 + y1) / 2)
-      = (val[0][0] + val[0][1] + val[1][0] + val[1][1]) / 4
-        + myrand(step) - step / 2;
-  }
+   set_midpoints((x0 + x1)/2, (y0 + y1)/2,
+      (val[0][0] + val[0][1] + val[1][0] 
+       + val[1][1])/4 + myrand(step) - step/2);
+ 
 
   /* now call recursively on the four subrectangles */
   gen5rec(2 * step / 3, x0, y0, (x1 + x0) / 2, (y1 + y0) / 2);
@@ -2344,6 +2393,8 @@
   int xmax = map.xsize - (xnowrap ? 1 : 0);
   int ymax = map.ysize - (ynowrap ? 1 : 0);
   int xn, yn, minval;
+  int T=0;
+
   /* just need something > log(max(xsize, ysize)) for the recursion */
   int step = map.xsize + map.ysize; 
   /* edges are avoided more strongly as this increases */
@@ -2359,36 +2410,26 @@
   /* set initial points */
   for (xn = 0; xn < xdiv2; xn++) {
     for (yn = 0; yn < ydiv2; yn++) {
-      hnat(xn * xmax / xdiv, yn * ymax / ydiv)
-       =  myrand(2 * step) - (2 * step) / 2;
-    }
-  }
-
-  /* if we aren't wrapping stay away from edges to some extent, try
-     even harder to avoid the edges naturally if separatepoles is true */
-  if (xnowrap) {
-    for (yn = 0; yn < ydiv2; yn++) {
-      hnat(0, yn * ymax / ydiv) -= avoidedge;
-      hnat(xmax, yn * ymax / ydiv) -= avoidedge;
-      if (map.separatepoles && has_poles) {
-       hnat(2, yn * ymax / ydiv)
-         = hnat(0, yn * ymax / ydiv) - myrand(3*avoidedge);
-       hnat(xmax - 2, yn * ymax / ydiv) 
-         = hnat(xmax, yn * ymax / ydiv) - myrand(3 * avoidedge);
-      }
-    }
-  }
-
-  if (ynowrap) {
-    for (xn = 0; xn < xdiv2; xn++) {
-      hnat(xn * xmax / xdiv, 0) -= avoidedge;
-      hnat(xn * xmax / xdiv, ymax) -= avoidedge;
-      if (map.separatepoles && has_poles) {
-       hnat(xn * xmax / xdiv, 2)
-         = hnat(xn * xmax / xdiv, 0) - myrand(3 * avoidedge);
-       hnat(xn * xmax / xdiv, ymax - 2) 
-         = hnat(xn * xmax / xdiv, ymax) - myrand(3 * avoidedge);
-      }
+      do_in_map_pos(x, y, (xn * xmax / xdiv), (yn * ymax / ydiv)) {
+       /* set initial points */
+       hmap(x, y) =
+           myrand(2 * step) - (2 * step) / 2;
+
+       /* avoid edges (simplest topologicals singularities) */
+       if (near_singularity(x, y))
+         hmap(x, y ) -= avoidedge;
+
+       if (has_poles) {
+         T = map_clima(x, y);
+         if (T <= 8) {
+           hmap(x, y) -= myrand(avoidedge);
+           /* avoid too higth poles */
+         } else if (map.separatepoles && T <= 12) {
+           hmap(x, y) -= myrand(3 * avoidedge);
+           /* separate poles */
+         }
+       }
+      } do_in_map_pos_end;
     }
   }
 

[Prev in Thread] Current Thread [Next in Thread]