[Freeciv-Dev] Re: bug in mapgen (PR#1043)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
I would delete the lines. I don't think they are actually used after
this point, but I didn't do an exhaustive check. Create_island() resets
them each time, and when you leave at this point you aren't looping
back to place_island().
Since they are (badly named) globals anybody could access them, but it
isn't really likely.
Cheers,
RossW
=====
At 07:50 AM 01/10/31 -0800, jdorje@xxxxxxxxxxxxxxxxxxxxx wrote:
>There is a bug in map generators 3 and 4 (or 2 and 3, depending on your
>numbering) that causes the creation of non-normal, out-of-bounds
>coordiantes. This happens in place_island(); after the main body of the
>function the rectangle defined by the n,s,e,w variables is translated to
>have its origin at the randomly found new position. However no checking
>is done to see if this newly formed rectangle is entirely within the
>"normal" region.
>
>The attached patch provides a simple fix for this. This may not be the
>correct fix, but the code there now is pretty certainly a bug. Ross,
>how would you fix it?
>
>jasonIndex: server/mapgen.c
>===================================================================
>RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
>retrieving revision 1.76
>diff -u -r1.76 mapgen.c
>--- server/mapgen.c 2001/10/30 10:59:20 1.76
>+++ server/mapgen.c 2001/10/31 15:45:32
>@@ -1586,8 +1586,8 @@
> i++;
> }
> }
>- s += yo - n;
>- e += xo - w;
>+ s = MIN(yo + (s - n), map.ysize-1);
>+ e = MIN(xo + (e - w), map.xsize-1);
> n = yo;
> w = xo;
> return i;
>
|
|