Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9769) PATCH Handle new ocean types for gen 1,5
Home

[Freeciv-Dev] (PR#9769) PATCH Handle new ocean types for gen 1,5

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9769) PATCH Handle new ocean types for gen 1,5
From: "Marcelo Burda" <mburda@xxxxxxxxx>
Date: Sun, 22 Aug 2004 16:17:24 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch can be used after 6007 and 9627 to allow generator 1 and 5 to
use news oceans types.

Marcelo
diff -ruN -Xfreeciv/diff_ignore freeciv_/server/mapgen.c 
freeciv__/server/mapgen.c
--- freeciv_/server/mapgen.c    2004-08-22 19:17:29.377686712 +0200
+++ freeciv__/server/mapgen.c   2004-08-22 19:45:07.545606872 +0200
@@ -77,7 +77,7 @@
 
 static int *height_map;
 static const int maxval=1000;
-static int reliefval=0, seaval=0;
+static int reliefval=0, seaval=0, deepoceanval=0;
 static int forests_to_be_placed =0;
 static int deserts_to_be_placed=0;
 static int grass_to_be_placed=0;
@@ -346,12 +346,21 @@
   return TRUE;
 }
 
+static bool ocean_is_near_high_zones(int mx,int my,int d,int thill)
+{
+  square_iterate(mx, my, d, x1, y1) {
+    if (hmap(x1, y1) >= thill) {
+      return TRUE;
+    }
+  } square_iterate_end;
+  return FALSE;
+}
+
 /**************************************************************************
   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).
-  TODO: extend to place ocean/deepocean/abys relief in oceans
 **************************************************************************/
 static void make_relief()
 {
@@ -370,6 +379,25 @@
       }  
     }
   } whole_map_iterate_end;
+
+  deepoceanval  = (seaval) * 0.60 ;
+
+  whole_map_iterate(x, y) {
+   if (!not_placed(x,y)) {
+     /* put ocean in higer zones */
+     if(hmap(x, y)  > deepoceanval  
+       || ocean_is_near_high_zones(x, y,1, seaval)) { continue; } /* ocean */
+     /* esle put abyss */  
+     if(hmap(x, y)  < deepoceanval * 0.3 
+       || !ocean_is_near_high_zones(x, y,2, deepoceanval)) {
+       map_set_terrain(x, y, T_ABYSS);
+       continue;
+     }
+     /* finaly put deep ocean */
+       map_set_terrain(x, y, T_DEEPOCEAN);
+    }
+  } whole_map_iterate_end;
+
 }
 
 /****************************************************************************

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9769) PATCH Handle new ocean types for gen 1,5, Marcelo Burda <=