[Freeciv-Dev] Re: (PR#6839) gen5 hmap buglet
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=6839 >
Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=6839 >
>
> Jason Short wrote:
>
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=6839 >
>>
>>Mapgen generator 5 has a buglet in the generation of the hmap. The
>>minimum/maximum values (used for calibration) may be incorrect, since
>>the base value hmap(0,0) has little relation to any actual hmap value
>>(the values are adjusted while finding the min/max).
Argh. Patch attached.
jason
? genlist_safe_unlink.diff
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.119
diff -u -r1.119 mapgen.c
--- server/mapgen.c 2003/10/21 22:04:53 1.119
+++ server/mapgen.c 2003/11/12 03:02:47
@@ -2170,16 +2170,17 @@
}
}
+ /* put in some random fuzz */
+ whole_map_iterate(x, y) {
+ hmap(x, y) = 8 * hmap(x, y) + myrand(4) - 2;
+ } whole_map_iterate_end;
+
+ /* and calibrate maxval and minval */
maxval = hmap(0, 0);
minval = hmap(0, 0);
whole_map_iterate(x, y) {
- /* put in some random fuzz */
- hmap(x, y) = 8 * hmap(x, y) + myrand(4) - 2;
- /* and calibrate maxval and minval */
- if (hmap(x, y) > maxval)
- maxval = hmap(x, y);
- if (hmap(x, y) < minval)
- minval = hmap(x, y);
+ maxval = MAX(maxval, hmap(x, y));
+ minval = MIN(minval, hmap(x, y));
} whole_map_iterate_end;
maxval -= minval;
adjust_map(minval);
|
|