Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2000:
[Freeciv-Dev] Mapgen: Patch and Question
Home

[Freeciv-Dev] Mapgen: Patch and Question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Mapgen: Patch and Question
From: ½²«íµØ <iquin@xxxxxxxxxx>
Date: Sun, 23 Jan 2000 08:46:19 -0500 (EST)

Hello List,

Below is a patch to reduce single tile rivers along coastlines.
Question: Shouldn't river appear on tiles other than grasslands
and plains?

Regards,
I.Q.

--- freeciv-cvs-Jan-20/server/mapgen.c  Mon Jan  3 11:50:53 2000
+++ freeciv/server/mapgen.c     Sun Jan 23 20:00:39 2000
@@ -1109,8 +1109,9 @@
   while (i && failsafe--) {
     y = myrand(s - n) + n;
     x = myrand(e - w) + w;
-    if (map_get_continent(x,y) == isleindex &&
-               map_get_terrain(x,y) == T_GRASSLAND) {
+    if (map_get_continent(x,y) == isleindex
+       && !(map_get_special(x, y) & S_RIVER)
+       && map_get_terrain(x,y) == T_GRASSLAND) {
 
       /* the first condition helps make terrain more contiguous,
         the second lets it avoid the coast: */
@@ -1121,7 +1122,7 @@
             || is_terrain_near_tile(x,y,cold0) 
             || is_terrain_near_tile(x,y,cold1) 
             )
-         &&( !is_terrain_near_tile(x, y, T_OCEAN) || myrand(100) < coast )) {
+         &&( !is_at_coast(x, y) || myrand(100) < coast )) {
         if (cold1 != T_RIVER) {
           if ( is_cold(x,y) )
             map_set_terrain(x, y, 
(myrand(cold0_weight+cold1_weight)<cold0_weight) 
@@ -1130,8 +1131,9 @@
             map_set_terrain(x, y, 
(myrand(warm0_weight+warm1_weight)<warm0_weight) 
                            ? warm0 : warm1);
         } else {
-          if (is_water_adjacent_to_tile(x, y) &&
-            count_terrain_near_tile(x, y, T_RIVER) < 3)
+          if (is_water_adjacent_to_tile(x, y)
+               && count_terrain_near_tile(x, y, T_OCEAN) < 4
+               && count_terrain_near_tile(x, y, T_RIVER) < 3)
               map_set_terrain(x, y, T_RIVER);
            }
       }
@@ -1170,9 +1172,10 @@
             || is_special_type_close(x,y,S_RIVER)
             || myrand(100)<50 
             )
-         &&( !is_terrain_near_tile(x, y, T_OCEAN) || myrand(100) < coast )) {
-       if (is_water_adjacent_to_tile(x, y) &&
-            count_special_near_tile(x, y, S_RIVER) < 3) {
+         &&( !is_at_coast(x, y) || myrand(100) < coast )) {
+       if (is_water_adjacent_to_tile(x, y)
+               && count_terrain_near_tile(x, y, T_OCEAN) < 4
+               && count_special_near_tile(x, y, S_RIVER) < 3) {
          map_set_special(x, y, S_RIVER);
          i--;
        }
@@ -1344,6 +1347,10 @@
            islemass, i, balance, checkmass);
 
     i *= tilefactor;
+    if (terrain_control.river_style==R_AS_SPECIAL) {
+      riverbuck += map.riverlength / 10 * i;
+      fillislandrivers(1, &riverbuck);
+    }
     if (terrain_control.river_style==R_AS_TERRAIN) {
       riverbuck += map.riverlength / 10 * i;
       fillisland(1, &riverbuck,
@@ -1366,10 +1373,6 @@
     fillisland(80, &swampbuck,
               map.swampsize, map.swampsize, map.swampsize, map.swampsize,
                T_SWAMP, T_SWAMP, T_SWAMP, T_SWAMP);
-    if (terrain_control.river_style==R_AS_SPECIAL) {
-      riverbuck += map.riverlength / 10 * i;
-      fillislandrivers(1, &riverbuck);
-    }
 
     isleindex++;
     map.num_continents++;
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com?sr=mc.mk.mcm.tag001


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