Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9627) PATCH: correct some parameters in map generator
Home

[Freeciv-Dev] (PR#9627) PATCH: correct some parameters in map generator

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9627) PATCH: correct some parameters in map generator and clean-up
From: "Marcelo Burda via RT" <mburda@xxxxxxxxx>
Date: Thu, 2 Sep 2004 09:29:07 -0700
Reply-to: RT_CorrespondAddressNotSet@xxxxxxxxxxxxxx

<URL: http://RT::WebBaseURL.not.configured:80/Ticket/Display.html?id=9627 >

> [mburda - Mer. Sep. 01 18:39:00 2004]:
> 
> I remember this not change default value of option a fix a lot of bugs
> 
> UPDATE to last depend patch
> 

diff -ruN -Xfreeciv/diff_ignore freeciv__/server/mapgen.c 
freeciv_/server/mapgen.c
--- freeciv__/server/mapgen.c   2004-09-02 14:22:18.000000000 +0200
+++ freeciv_/server/mapgen.c    2004-09-02 15:39:05.000000000 +0200
@@ -90,7 +90,10 @@
 static const int hmap_max_level = 1000;
 static int hmap_shore_level, hmap_mountain_level;
 
-static int forests=0;
+static int forests_to_be_placed = 0;
+static int deserts_to_be_placed = 0;
+static int plains_to_be_placed = 0;
+static int swamps_to_be_placed = 0;
 
 struct isledata {
   int goodies;
@@ -111,13 +114,27 @@
 /* An estimate of the linear (1-dimensional) size of the map. */
 #define SQSIZE MAX(1, sqrt(map.xsize * map.ysize / 1000))
 
+/* define the 5 region of a Earth like map
+   =========================================================
+    0-COLD_LV                cold region: 
+    COLD_LV-TREOPICAL_LV     temperate wet region: 
+    TROPICAL_LV-MAX_TEMP     tropical wet region:
+
+   and a dry region, this last one can ovelap others 
+   DRY_MIN_LEVEL- DRY_MAX_LEVEL
+ */
+#define COLD_LEVEL (10 * MAX_TEMP / 100)
+#define TROPICAL_LEVEL (70 * MAX_TEMP / 100)
+#define DRY_MIN_LEVEL (65 * MAX_TEMP / 100)
+#define DRY_MAX_LEVEL (80 * MAX_TEMP / 100)
+
 /* used to create the poles and for separating them.  In a
  * mercator projection map we don't want the poles to be too big. */
 #define ICE_BASE_LEVEL                                         \
   ((!topo_has_flag(TF_WRAPX) || !topo_has_flag(TF_WRAPY))      \
    /* 5% for little maps; 2% for big ones */                   \
    ? MAX_TEMP * (3 + 2 * SQSIZE) / (100 * SQSIZE)              \
-   : 5 * MAX_TEMP / 100  /* 5% for all maps */)
+   : COLD_LEVEL / 2  /* for all maps */)
 
 /****************************************************************************
   Used to initialize an array 'a' of size 'size' with value 'val' in each
@@ -314,12 +331,58 @@
 }
 
 /**************************************************************************
-  make_mountains() will convert all squares that are higher than thill to
+  we don't want huge areas of grass/plains, 
+  so we put in a hill here and there, where it gets too 'clean' 
+
+  Return TRUE if the terrain at the given map position is "clean".  This
+  means that all the terrain for 2 squares around it is not mountain or hill.
+****************************************************************************/
+static bool terrain_is_to_flat(int map_x, int map_y,int thill, int my_high)
+{
+  int biger_me = 0;
+  square_iterate(map_x, map_y, 2, x1, y1) {
+    if (hmap(x1, y1) > thill) {
+      return FALSE;
+    }
+    if (hmap(x1, y1) > my_high){
+      if(map_distance(map_x, map_y, x1, y1) == 1) {
+       return FALSE;
+      }
+      if(++biger_me > 2) {
+       return FALSE;
+      };
+    }
+  } square_iterate_end;
+
+  if ((thill - hmap_shore_level) * (biger_me)  > (my_high - hmap_shore_level) 
* 4 ) {
+      return FALSE;
+  }
+  return TRUE;
+}
+
+/**************************************************************************
+  we don't want huge areas of hill/mountains, 
+  so we put in a plains here and there, where it gets too 'height' 
+
+  Return TRUE if the terrain at the given map position is to height.
+****************************************************************************/
+static bool terrain_is_to_height(int map_x, int map_y,int thill, int my_high)
+{
+  square_iterate(map_x, map_y, 1, x1, y1) {
+    if (hmap(x1, y1) +(hmap_max_level - hmap_mountain_level) / 5 < thill) {
+      return FALSE;
+    }
+  } square_iterate_end;
+  return TRUE;
+}
+
+/**************************************************************************
+  make_relief() will convert all squares that are higher than thill to
   mountains and hills. Notice that thill will be adjusted according to
   the map.mountains value, so increase map.mountains and you'll get more 
   hills and mountains (and vice versa).
 **************************************************************************/
-static void make_mountains(void)
+static void make_relief(void)
 {
   /* Calculate the mountain level.  map.mountains specifies the percentage
    * of land that is turned into hills and mountains. */
@@ -327,14 +390,17 @@
                         * (100 - map.mountains)) / 100 + hmap_shore_level;
 
   whole_map_iterate(x, y) {
-    if (hmap(x, y) > hmap_mountain_level
-       && !is_ocean(map_get_terrain(x, y))) { 
+    if (not_placed(x,y) &&
+       ((hmap_mountain_level < hmap(x, y) && 
+         (myrand(10) > 5 
+          || !terrain_is_to_height(x, y, hmap_mountain_level, hmap(x, y))))
+        || terrain_is_to_flat(x, y, hmap_mountain_level, hmap(x, y)))) {
       /* Randomly place hills and mountains on "high" tiles.  But don't
        * put hills near the poles (they're too green). */
-      if (myrand(100) > 75 
-         || map_temperature(x, y) <= MAX_TEMP / 10) {
+      if (myrand(100) > 70 
+         || map_temperature(x, y) <= COLD_LEVEL) {
        map_set_terrain(x, y, T_MOUNTAINS);
-      } else if (myrand(100) > 25) {
+      } else {
        map_set_terrain(x, y, T_HILLS);
       }
     }
@@ -374,6 +440,24 @@
     }
   } whole_map_iterate_end;
 }
+/*************************************************************************
+ if separatepoles is set, return false if this tile has to kip ocean
+************************************************************************/
+static bool ok_for_separate_poles(int x, int y) 
+{
+  if (!map.separatepoles) {
+    return TRUE;
+  }
+  adjc_iterate(x, y, x1, y1) {
+    if(!is_ocean(map_get_terrain(x1, y1))
+       && map_get_continent(x1, y1 ) != 0) {
+      return FALSE;
+    }
+  } adjc_iterate_end;
+  return TRUE;
+}
+
+
 
 /****************************************************************************
   Place untextured land at the poles.  This is used by generators 1 and 5.
@@ -384,30 +468,17 @@
   struct tile *ptile;
   int T;
 
+  assign_continent_numbers();
   whole_map_iterate(map_x, map_y) {
     T = map_temperature(map_x, map_y); /* temperature parameter */
     ptile = map_get_tile(map_x, map_y);
-    if (T < 1.5 * ICE_BASE_LEVEL) {
+    if (T < 1.5 * ICE_BASE_LEVEL && ok_for_separate_poles(map_x, map_y)) {
       ptile->terrain = T_NOT_PLACED;
-    } else if ((T <= 2 * ICE_BASE_LEVEL) && myrand(10) > 4 ) { 
+      map_set_continent(map_x, map_y, 0);
+    } else if ((T <= 2 * ICE_BASE_LEVEL) 
+              && myrand(10) > 4 && ok_for_separate_poles(map_x, map_y)) { 
       ptile->terrain = T_NOT_PLACED;
-    }
-  } whole_map_iterate_end;
-}
-
-/****************************************************************************
-  Create tundra in cold zones.  Used by generators 1 and 5.  This must be
-  called after make_arctic since it will fill all remaining untextured
-  areas (we don't want any grassland left on the poles).
-****************************************************************************/
-static void make_tundra(void)
-{
-  whole_map_iterate(x, y) {
-    int T = map_temperature(x, y);
-
-    if (not_placed(x,y) 
-       && (2 * ICE_BASE_LEVEL > T || myrand(MAX_TEMP/5) > T)) {
-      map_set_terrain(x, y, T_TUNDRA);
+      map_set_continent(map_x, map_y, 0);
     }
   } whole_map_iterate_end;
 }
@@ -420,8 +491,8 @@
   whole_map_iterate(x, y) {
     int T = map_temperature(x, y);
 
-    if (not_placed(x,y) 
-       && myrand(15 * MAX_TEMP / 100) > T -  ICE_BASE_LEVEL 
+    if (not_placed(x, y)
+       && myrand(1.5 * COLD_LEVEL) > T -  ICE_BASE_LEVEL 
        && T <= 3 * ICE_BASE_LEVEL) {
       map_set_terrain(x, y, T_ARCTIC);
     }
@@ -442,14 +513,18 @@
 {
   const int DeltaT = MAX_TEMP / (3 * SQSIZE);
 
+  if(deserts_to_be_placed <= 0) { return; }
+
   if (abs(hmap(x, y) - height) < diff 
-      && not_placed(x,y)) {
+      && not_placed(x, y) && (count_ocean_near_tile(x,y,FALSE) <= 2 ||
+                             /* the myrand is to avoid infinite loops */
+         (myrand(10) < 2))) {
     map_set_terrain(x, y, T_DESERT);
+    deserts_to_be_placed--;
     cardinal_adjc_iterate(x, y, x1, y1) {
       make_desert(x1, y1, height,
                  diff - 1 - abs(map_temperature(x1, y1) - base_T) / DeltaT,
                  base_T);
-     
     } cardinal_adjc_iterate_end;
   }
 }
@@ -462,17 +537,17 @@
 **************************************************************************/
 static void make_forest(int map_x, int map_y, int height, int diff)
 {
-  int nat_x, nat_y, T;
+  int T;
 
-  map_to_native_pos(&nat_x, &nat_y, map_x, map_y);
-  T = map_temperature(map_x, map_y);
+  if(forests_to_be_placed <= 0) { return; }
   if (not_placed(map_x, map_y)) {
-    if (T > 8 * MAX_TEMP / 10 
-       && myrand(1000) > 500 - 300 * (T * 1000 / MAX_TEMP - 800)) {
+    if ((T = map_temperature(map_x, map_y)) > TROPICAL_LEVEL 
+       && (myrand(100) >  50)) {
       map_set_terrain(map_x, map_y, T_JUNGLE);
     } else {
       map_set_terrain(map_x, map_y, T_FOREST);
     }
+    forests_to_be_placed--;
     if (abs(hmap(map_x, map_y) - height) < diff) {
       cardinal_adjc_iterate(map_x, map_y, x1, y1) {
        if (myrand(10) > 5) {
@@ -480,113 +555,169 @@
        }
       } cardinal_adjc_iterate_end;
     }
-    forests++;
   }
 }
 
 /**************************************************************************
-  makeforest calls make_forest with random unplaced locations until there
-  has been made enough forests. (the map.forestsize value controls this) 
+  a recursive function that adds swamps to the current location and try
+  to spread out to the neighbours.
 **************************************************************************/
-static void make_forests(void)
+static void make_swamp(int map_x, int map_y, int height, int diff)
 {
-  int x, y;
-  int forestsize = (map_num_tiles() * map.forestsize) / 1000;
-
-  forests = 0;
-
-  do {
-    /* Place one forest clump anywhere. */
-    if (rand_map_pos_temperature(&x, &y,
-                                MAX_TEMP / 10, MAX_TEMP,
-                                T_NOT_PLACED)) {
-      make_forest(x, y, hmap(x, y), 25);
-    } else { 
-      /* If rand_map_pos_temperature returns FALSE we may as well stop
-       * looking. */
-      break;
-    }
-
-    /* Now add another tropical forest clump (70-100% temperature). */
-    if (rand_map_pos_temperature(&x, &y,
-                                7 *MAX_TEMP / 10, MAX_TEMP,
-                                T_NOT_PLACED)) {
-      make_forest(x, y, hmap(x, y), 25);
-    }
+  if(swamps_to_be_placed <= 0) { return; }
+  if((map_temperature(map_x, map_y) < DRY_MAX_LEVEL)
+     && (map_temperature(map_x, map_y) > DRY_MIN_LEVEL)
+     && (myrand(100) >  20) ) {  return; }
+  if (not_placed(map_x, map_y) 
+      && ((2 * (hmap(map_x, map_y) - hmap_shore_level) 
+          < myrand(hmap_mountain_level - hmap_shore_level))
+         /* avoid infinite loop */ 
+         || (myrand(20) < 5))) {
+    map_set_terrain(map_x, map_y, T_SWAMP);
+    swamps_to_be_placed--;
+    if (abs(hmap(map_x, map_y) - height) < diff) {
+      cardinal_adjc_iterate(map_x, map_y, x1, y1) {
+       make_forest(x1, y1, height, diff - 5);
+      } cardinal_adjc_iterate_end;
+    } 
+  }
+}
 
-    /* And add a cold forest clump (10%-30% temperature). */
-    if (rand_map_pos_temperature(&x, &y,
-                                1 * MAX_TEMP / 10, 3 * MAX_TEMP / 10,
-                                T_NOT_PLACED)) {
-      make_forest(x, y, hmap(x, y), 25);
+/**************************************************************************
+  a simple function that adds plains (,grassland or tundra) to the 
+  current location.
+**************************************************************************/
+static void make_plain(int x, int y)
+{
+  int T = map_temperature(x, y);
+  /* in cold place we get tundra instead */
+  if((2 * ICE_BASE_LEVEL > T) ||
+   ((COLD_LEVEL > T) && (myrand(COLD_LEVEL*COLD_LEVEL) > T*T))) {
+    map_set_terrain(x, y, T_TUNDRA); 
+  } else {
+    if(myrand(100) > 50) {
+      map_set_terrain(x, y, T_GRASSLAND);
+    } else {
+      map_set_terrain(x, y, T_PLAINS);
     }
-  } while (forests < forestsize);
+  }
+  plains_to_be_placed--;
 }
 
 /**************************************************************************
-  swamps, is placed on low lying locations, that will typically be close to
-  the shoreline. They're put at random (where there is grassland)
-  and with 50% chance each of it's neighbour squares will be converted to
-  swamp aswell
+  make_plains converts all not yet placed terrains to plains (tundra, grass) 
+  used by generators 2-4
 **************************************************************************/
-static void make_swamps(void)
+static void make_plains(void)
 {
-  int x, y, swamps;
-  int forever = 0;
-  const int swamps_to_be_placed 
-      = MAX_MAP_INDEX *  map.swampsize * map.landpercent;
-  const int hmap_swamp_level = ((hmap_max_level - hmap_shore_level)
-                         * 2 * map.swampsize) / 100 + hmap_shore_level;
-
-  for (swamps = 0; swamps < swamps_to_be_placed; ) {
-    forever++;
-    if (forever > 100) {
-      return;
-    }
-    rand_map_pos(&x, &y);
-    if (not_placed(x, y)
-       && hmap(x, y) < hmap_swamp_level) {
-      map_set_terrain(x, y, T_SWAMP);
-      cardinal_adjc_iterate(x, y, x1, y1) {
-       if (myrand(10) > 5 && !is_ocean(map_get_terrain(x1, y1)) 
-           && map_get_terrain(x1, y1) != T_SWAMP ) { 
-         map_set_terrain(x1, y1, T_SWAMP);
-         swamps++;
-          forever = 0;
-       }
-      } cardinal_adjc_iterate_end;
-      swamps++;
+  whole_map_iterate(x, y) {
+    if (not_placed(x, y)) {
+      make_plain(x, y);
     }
-  }
+  } whole_map_iterate_end;
 }
 
-/*************************************************************************
-  Make deserts until we have enough of them.
+/**************************************************************************
+  make_terrains calls make_forest, make_dessert,etc  with random free 
+  locations until there  has been made enough.
+ Comment: funtions as make_swamp, etc. has to have a non 0 probability
+ to place one terrains in called position. Else make_terrains will get
+ in a infinite loop!
 **************************************************************************/
-static void make_deserts(void)
+static void make_terrains(void)
 {
-  int x, y, i = map.deserts, j = 0;
+  int x, y;
+  int total = 0;
+  whole_map_iterate(x, y) {
+    if(not_placed(x,y)) {
+     total++;
+    }
+  } whole_map_iterate_end;
+
+  forests_to_be_placed = total * map.forestsize
+       / ( map.forestsize + map.deserts + map.grasssize +  map.swampsize );
+  deserts_to_be_placed = total * map.deserts
+       / ( map.forestsize + map.deserts + map.grasssize +  map.swampsize);
+  swamps_to_be_placed = total * map.swampsize
+       / ( map.forestsize + map.deserts + map.grasssize +  map.swampsize);
+
+  /* grassland, tundra and plains is counted in map.grasssize */
+  plains_to_be_placed = total - forests_to_be_placed - deserts_to_be_placed
+                       - swamps_to_be_placed;
+  /* the plasing loop */
+  do {
+    if(forests_to_be_placed > 0) {
+      /* Place one forest clump between Very Cold level and MAX_TEMP. */
+      if (rand_map_pos_temperature(&x, &y,
+                                  (COLD_LEVEL + ICE_BASE_LEVEL) / 2, MAX_TEMP,
+                                  T_NOT_PLACED)) {
+       make_forest(x, y, hmap(x, y), 25);
+      } else { 
+        /* If rand_map_pos_temperature returns FALSE we may as well stop
+         * looking for forest. */
+       plains_to_be_placed += forests_to_be_placed;
+       forests_to_be_placed = 0;
+      }
+    }
 
-  /* "i" is the number of desert clumps made; "j" is the number of tries. */
-  /* TODO: j is no longer needed */
-  while (i > 0 && j < 100 * map.deserts) {
-    j++;
+    if(swamps_to_be_placed > 0) {
+      /* Place one swamp clump between COLD_LEVEL and MAX_TEMP.. */
+      if (rand_map_pos_temperature(&x, &y,
+                                  COLD_LEVEL, MAX_TEMP,
+                                  T_NOT_PLACED)) {
+       make_swamp(x, y, hmap(x, y), 25);
+      } else { 
+        /* If rand_map_pos_temperature returns FALSE we may as well stop
+         * looking for swamp. */
+       plains_to_be_placed += swamps_to_be_placed; /* reactivate plains */
+       swamps_to_be_placed = 0;
+      }
+    }
 
-    /* Choose a random coordinate between 20 and 30 degrees north/south
-     * (deserts tend to be between 15 and 35; make_desert will expand
-     * them). */
-    if (rand_map_pos_temperature(&x, &y,
-                                65 * MAX_TEMP / 100, 80 * MAX_TEMP / 100,
-                                T_NOT_PLACED)){
-      make_desert(x, y, hmap(x, y), 50, map_temperature(x, y));
-      i--;
-    } else {
-      /* If rand_map_pos_temperature returns FALSE we may as well stop
-       * looking. */
-      break;
+    if(deserts_to_be_placed > 0) {
+      /* Choose a random coordinate in dry zone;
+        make_desert will expand them). */
+      if (rand_map_pos_temperature(&x, &y,
+                                  DRY_MIN_LEVEL, DRY_MAX_LEVEL,
+                                  T_NOT_PLACED)){
+         make_desert(x, y, hmap(x, y), 40, map_temperature(x, y));
+         /* if not posible try lower latitude */
+      } else if (rand_map_pos_temperature(&x, &y,
+                                  0, DRY_MAX_LEVEL,
+                                  T_NOT_PLACED)){
+         make_desert(x, y, hmap(x, y), 40, map_temperature(x, y));
+      } else {
+       /* If rand_map_pos_temperature returns FALSE we may as well stop
+        * looking for dessert. (convert to plains) */
+       plains_to_be_placed += deserts_to_be_placed;
+       deserts_to_be_placed = 0;
+      }
     }
-  }
+
+    /* there is very important: this place all terrains when there
+       is not posibe for other types kip the 0, MAX_TEMP range. */
+    /* make the plains and tundras */
+    if(plains_to_be_placed > 0) {
+     if (rand_map_pos_temperature(&x, &y,
+                          0, MAX_TEMP,
+                          T_NOT_PLACED)){
+       make_plain(x,y);
+      } else {
+       /* If rand_map_pos_temperature returns FALSE we may as well stop
+        * looking for plains. */
+       plains_to_be_placed = 0;
+      }
+    }
+
+  } while (forests_to_be_placed > 0 || deserts_to_be_placed > 0 
+          || plains_to_be_placed > 0 || swamps_to_be_placed > 0 );
+
+  /* final test */
+  whole_map_iterate(x, y) {
+    assert(!not_placed(x,y));
+  } whole_map_iterate_end;
 }
+  
 
 /*********************************************************************
  Returns the number of adjacent river tiles of a tile. This can be 0
@@ -841,7 +972,7 @@
     if (adjacent_river_tiles4(x, y) != 0
        || count_ocean_near_tile(x, y, TRUE) != 0
         || (map_get_terrain(x, y) == T_ARCTIC 
-           && map_temperature(x, y) < 8 * MAX_TEMP / 100)) { 
+           && map_temperature(x, y) < 0.8 * COLD_LEVEL)) { 
 
       freelog(LOG_DEBUG,
              "The river ended at (%d, %d).\n", x, y);
@@ -945,7 +1076,8 @@
      * 1000 rather than the current 100 */
     10 *
     /* The size of the map (poles don't count). */
-    map_num_tiles() * (map.alltemperate ? 1.0 : 0.90) *
+    map_num_tiles() 
+      * (map.alltemperate ? 1.0 : 2.0 * ICE_BASE_LEVEL/MAX_TEMP) *
     /* Rivers need to be on land only. */
     map.landpercent /
     /* Adjustment value. Tested by me. Gives no rivers with 'set
@@ -1053,61 +1185,6 @@
   river_map = NULL;
 }
 
-/**************************************************************************
-  make_plains converts 50% of the remaining terrains to plains and 50%
-  grassland,
-**************************************************************************/
-static void make_plains(void)
-{
-  whole_map_iterate(x, y) {
-    if (not_placed(x, y)) {
-      if(myrand(100) > 50) {
-         map_set_terrain(x, y, T_GRASSLAND);
-      } else {
-         map_set_terrain(x, y, T_PLAINS);
-      }
-    }
-  } whole_map_iterate_end;
-}
-/****************************************************************************
-  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
-  plains.
-****************************************************************************/
-static bool terrain_is_clean(int map_x, int map_y)
-{
-  square_iterate(map_x, map_y, 2, x1, y1) {
-    if (map_get_terrain(x1, y1) != T_GRASSLAND
-       && map_get_terrain(x1, y1) != T_PLAINS) {
-      return FALSE;
-    }
-  } square_iterate_end;
-
-  return TRUE;
-}
-
-/**************************************************************************
-  we don't want huge areas of grass/plains, 
- so we put in a hill here and there, where it gets too 'clean' 
-**************************************************************************/
-static void make_fair(void)
-{
-  whole_map_iterate(map_x, map_y) {
-    if (terrain_is_clean(map_x, map_y)) {
-      if (!map_has_special(map_x, map_y, S_RIVER)) {
-       map_set_terrain(map_x, map_y, T_HILLS);
-      }
-      cardinal_adjc_iterate(map_x, map_y, x1, y1) {
-       if (myrand(100) > 66
-           && !is_ocean(map_get_terrain(x1, y1))
-           && !map_has_special(x1, y1, S_RIVER)) {
-         map_set_terrain(x1, y1, T_HILLS);
-       }
-      } cardinal_adjc_iterate_end;
-    }
-  } whole_map_iterate_end;
-}
-
 /****************************************************************************
   Lower the land near the polar region to avoid too much land there.
 
@@ -1157,7 +1234,9 @@
 static void make_land(void)
 {
   adjust_hmap();
-  normalize_hmap_poles();
+  if(!map.alltemperate) {
+    normalize_hmap_poles();
+  }
   hmap_shore_level = (hmap_max_level * (100 - map.landpercent)) / 100;
   whole_map_iterate(x, y) {
     if (hmap(x, y) < hmap_shore_level) {
@@ -1166,17 +1245,13 @@
       map_set_terrain(x, y, T_NOT_PLACED);
     }
   } whole_map_iterate_end;
-
-  renormalize_hmap_poles();
-  make_polar_land(); /* make extra land at poles*/
-  make_mountains();
-  make_arctic();
-  make_tundra();
-  make_swamps();
-  make_forests();
-  make_deserts();
-  make_plains();
-  make_fair();
+  if(!map.alltemperate) {
+    renormalize_hmap_poles(); 
+    make_polar_land(); /* make extra land at poles*/
+  }
+  make_relief(); /* base relief on map */
+  make_arctic(); 
+  make_terrains();/* place forest/dessert/swamp/grass/tundra and plains */
   make_rivers();
 
   assign_continent_numbers();
@@ -1631,9 +1706,9 @@
 static void adjust_terrain_param(void)
 {
   int total;
-  int polar = 5; /* FIXME: convert to a server option */
+  int polar = ICE_BASE_LEVEL * 100 / MAX_TEMP;
 
-  total = map.mountains + map.deserts + map.forestsize + map.swampsize 
+  total = map.mountains + map.deserts + map.forestsize + map.swampsize
     + map.grasssize;
 
   if (total != 100 - polar) {
@@ -2327,12 +2402,11 @@
     map_clear_all_specials(x, y);
     map_set_owner(x, y, NULL);
   } whole_map_iterate_end;
-  if (!map.alltemperate) {
-    make_polar();
+  if (!map.alltemperate) { make_polar(); }
     /* Set poles numbers.  After the map is generated continents will 
      * be renumbered. */
     assign_continent_numbers(); 
-  }
+
   make_island(0, 0, pstate, 0);
   for(i = 0; i <= map.num_continents; i++ ) {
       islands[i].starters = 0;
diff -ruN -Xfreeciv/diff_ignore freeciv__/server/stdinhand_info.h 
freeciv_/server/stdinhand_info.h
--- freeciv__/server/stdinhand_info.h   2004-09-02 14:12:26.000000000 +0200
+++ freeciv_/server/stdinhand_info.h    2004-09-02 15:20:50.000000000 +0200
@@ -268,7 +268,7 @@
 
   GEN_INT("grass", map.grasssize,
          SSET_MAP_GEN, SSET_ECOLOGY, SSET_SITUATIONAL, SSET_TO_CLIENT,
-         N_("Amount of grass squares"), "", NULL,
+         N_("Amount of grass/plains and tundra squares"), "", NULL,
          MAP_MIN_GRASS, MAP_MAX_GRASS, MAP_DEFAULT_GRASS)
 
   GEN_INT("forests", map.forestsize,

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