Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] bug in mapgen (PR#1043)
Home

[Freeciv-Dev] bug in mapgen (PR#1043)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] bug in mapgen (PR#1043)
From: jdorje@xxxxxxxxxxxxxxxxxxxxx
Date: Wed, 31 Oct 2001 07:50:26 -0800 (PST)

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?

jason
Index: 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;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] bug in mapgen (PR#1043), jdorje <=