Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10527) bug in generator 5
Home

[Freeciv-Dev] (PR#10527) bug in generator 5

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10527) bug in generator 5
From: "Marcelo Burda" <mburda@xxxxxxxxx>
Date: Fri, 15 Oct 2004 16:29:33 -0700
Reply-to: rt@xxxxxxxxxxx

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

> [mburda - Thu Oct 14 09:50:34 2004]:
fixed, this is a old bug in old generator 5 code, avoidedge was bad for
land larger than 50 pct.

in some patch i fix a posible problem in adjust_map (very very rare,
probably never seeded)

Macelo
? server/.kdbgrc.civserver
Index: server/generator/height_map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/generator/height_map.c,v
retrieving revision 1.6
diff -u -r1.6 height_map.c
--- server/generator/height_map.c       15 Oct 2004 09:39:06 -0000      1.6
+++ server/generator/height_map.c       15 Oct 2004 23:25:48 -0000
@@ -181,7 +181,7 @@
   /* just need something > log(max(xsize, ysize)) for the recursion */
   int step = map.xsize + map.ysize; 
   /* edges are avoided more strongly as this increases */
-  int avoidedge = (50 - map.landpercent) * step / 100 + step / 3; 
+  int avoidedge = (100 - map.landpercent) * step / 100 + step / 3; 
 
   height_map = fc_malloc(sizeof(int) * MAX_MAP_INDEX);
 
Index: server/generator/utilities.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/generator/utilities.c,v
retrieving revision 1.10
diff -u -r1.10 utilities.c
--- server/generator/utilities.c        15 Oct 2004 09:39:06 -0000      1.10
+++ server/generator/utilities.c        15 Oct 2004 23:25:48 -0000
@@ -116,6 +116,10 @@
     total++;
   } whole_map_iterate_filtered_end;
 
+  if (total == 0) {
+    return;
+  }
+
   {
     int const size = 1 + maxval - minval;
     int i, count = 0, frequencies[size];
@@ -126,7 +130,7 @@
        and count the number of occurencies of all values to initialize the 
        frequencies[] */
     whole_map_iterate_filtered(ptile, data, filter) {
-      int_map[ptile->index] = (int_map[ptile->index] - minval);
+      int_map[ptile->index] -= minval;
       frequencies[int_map[ptile->index]]++;
     } whole_map_iterate_filtered_end;
 

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