Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9895) PATCH Fix a bug in initialize height map in gene
Home

[Freeciv-Dev] (PR#9895) PATCH Fix a bug in initialize height map in gene

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9895) PATCH Fix a bug in initialize height map in generator 1
From: "Marcelo Burda" <mburda@xxxxxxxxx>
Date: Wed, 1 Sep 2004 03:42:26 -0700
Reply-to: rt@xxxxxxxxxxx

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

Depend on INITIALIZED_ARRAY defined in near commited #9799

Now generator 1 do best distributed maps

Marcelo

diff -ruN -Xfreeciv/diff_ignore freeciv_improved/server/mapgen.c 
freeciv_/server/mapgen.c
--- freeciv_improved/server/mapgen.c    2004-09-01 10:28:27.194809344 +0200
+++ freeciv_/server/mapgen.c    2004-09-01 10:36:44.070272792 +0200
@@ -1680,11 +1680,9 @@
 static void mapgenerator1(void)
 {
   int i;
-  height_map=fc_malloc (sizeof(int)*map.xsize*map.ysize);
+  height_map = fc_malloc (sizeof(int) * MAX_MAP_INDEX);
 
-  whole_map_iterate(x, y) {
-    hmap(x, y) = myrand(40) + ((500 - abs(map.ysize / 2 - y)) / 10);
-  } whole_map_iterate_end;
+  INITIALIZE_ARRAY(height_map, MAX_MAP_INDEX, myrand(40) );
 
   for (i=0;i<1500;i++) {
     int x, y;
@@ -2657,12 +2655,10 @@
   /* edges are avoided more strongly as this increases */
   int avoidedge = (50 - map.landpercent) * step / 100 + step / 3; 
 
-  height_map = fc_malloc(sizeof(int) * map.xsize * map.ysize);
+  height_map = fc_malloc(sizeof(int) * MAX_MAP_INDEX);
 
-  /* initialize map */
-  whole_map_iterate(x, y) {
-    hmap(x, y) = 0;
-  } whole_map_iterate_end;
+ /* initialize map */
+  INITIALIZE_ARRAY(height_map, MAX_MAP_INDEX, 0);
 
   /* set initial points */
   for (xn = 0; xn < xdiv2; xn++) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9895) PATCH Fix a bug in initialize height map in generator 1, Marcelo Burda <=