Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7252) further has_poles fixes
Home

[Freeciv-Dev] (PR#7252) further has_poles fixes

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7252) further has_poles fixes
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Jan 2004 21:20:07 -0800
Reply-to: rt@xxxxxxxxxxx

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

This patch includes three fixes for maps with no poles.

- In make_forests, we only want a bias toward equatorial forests if the 
map has poles.

- In make_rivers, we don't need a check for polar positions since there 
is already a check for arctic terrain.  Unless the map has no poles, in 
which case we don't want this check anyway.

- In make_fair, we again don't need a check for polar positions since 
these will fail the terrain_is_clean check anyway.

The latter two changes also help pave the way for iso-maps.

jason

Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.123
diff -u -r1.123 mapgen.c
--- server/mapgen.c     2004/01/08 17:02:58     1.123
+++ server/mapgen.c     2004/01/16 05:15:53
@@ -209,7 +209,7 @@
     if (map_get_terrain(x, y)==T_GRASSLAND) {
       make_forest(x,y, hmap(x, y), 25);
     }
-    if (myrand(100)>75) {
+    if (has_poles && myrand(100)>75) {
       y=(myrand(map.ysize*2/10))+map.ysize*4/10;
       x=myrand(map.xsize);
       if (map_get_terrain(x, y)==T_GRASSLAND) {
@@ -683,10 +683,7 @@
   while (current_riverlength < desirable_riverlength &&
         iteration_counter < RIVERS_MAXTRIES) {
 
-    /* Don't start any rivers at the poles. */
-    do {
-      rand_map_pos(&x, &y);
-    } while (y == 0 || y == map.ysize-1);
+    rand_map_pos(&x, &y);
 
     /* Check if it is suitable to start a river on the current tile.
      */
@@ -808,25 +805,22 @@
 **************************************************************************/
 static void make_fair(void)
 {
-  int x,y;
-  for (y=2;y<map.ysize-2;y++) {
-    for (x=0;x<map.xsize;x++) {
-      if (terrain_is_clean(x,y)) {
-       if (map_get_terrain(x, y) != T_RIVER &&
-           !map_has_special(x, y, S_RIVER)) {
-         map_set_terrain(x, y, T_HILLS);
-       }
-       cartesian_adjacent_iterate(x, y, x1, y1) {
-         if (myrand(100) > 66 &&
-             !is_ocean(map_get_terrain(x1, y1))
-             && map_get_terrain(x1, y1) != T_RIVER
-             && !map_has_special(x1, y1, S_RIVER)) {
-           map_set_terrain(x1, y1, T_HILLS);
-         }       
-       } cartesian_adjacent_iterate_end;
+  whole_map_iterate(map_x, map_y) {
+    if (terrain_is_clean(map_x, map_y)) {
+      if (map_get_terrain(map_x, map_y) != T_RIVER
+         && !map_has_special(map_x, map_y, S_RIVER)) {
+       map_set_terrain(map_x, map_y, T_HILLS);
       }
+      cartesian_adjacent_iterate(map_x, map_y, x1, y1) {
+       if (myrand(100) > 66
+           && !is_ocean(map_get_terrain(x1, y1))
+           && map_get_terrain(x1, y1) != T_RIVER
+           && !map_has_special(x1, y1, S_RIVER)) {
+         map_set_terrain(x1, y1, T_HILLS);
+       }
+      } cartesian_adjacent_iterate_end;
     }
-  }
+  } whole_map_iterate_end;
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7252) further has_poles fixes, Jason Short <=