[Freeciv-Dev] Re: bug in mapgen (PR#1043)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Ross W. Wetmore wrote:
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().
I do not think the lines can be deleted. The crash happens because of
the oddball random number generation in fill_island and
fill_island_rivers; these appear to use n/s/e/w as set up by
create_island and place_island. All of this takes place within make_island.
IMO the random map position should be done safely. The attached patch
does this in a simple (though not perfect) way.
Since they are (badly named) globals anybody could access them, but it
isn't really likely.
I strongly agree that the globals should be removed, and the data be
passed around in a struct as Raimar's patch accomplishes. Really,
though, that might as well be a different patch. Raimar: I think you
should apply it. If you want I'll clean it up (by removing the
bug-related code).
jason
? freeciv.kdevses
? old
? topology
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.77
diff -u -r1.77 mapgen.c
--- server/mapgen.c 2001/11/11 17:46:21 1.77
+++ server/mapgen.c 2001/11/26 13:56:10
@@ -1457,8 +1457,10 @@
i= 0;
while (i && failsafe--) {
+ do {
y = myrand(s - n) + n;
x = myrand(e - w) + w;
+ } while (!normalize_map_pos(&x, &y));
if (map_get_continent(x,y) == isleindex &&
map_get_terrain(x,y) == T_GRASSLAND) {
@@ -1510,8 +1512,10 @@
if(failsafe<0){ failsafe= -failsafe; }
while (i && failsafe--) {
+ do {
y = myrand(s - n) + n;
x = myrand(e - w) + w;
+ } while (!normalize_map_pos(&x, &y));
if (map_get_continent(x,y) == isleindex &&
map_get_terrain(x,y) == T_GRASSLAND) {
|
|