Complete.Org: Mailing Lists: Archives: freeciv-dev: December 1998:
Re: [Freeciv-Dev] segmentation fault
Home

Re: [Freeciv-Dev] segmentation fault

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: andrex@xxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] segmentation fault
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Wed, 9 Dec 1998 23:43:09 +1100

Andrew E. Schulman wrote:
> 
> I'm having trouble playing the "europe.sav" scenario.  I'm using CVS 12/8,
> under Solaris.  I start the civserver with the scenario, set aifill 5, set
> hard, start the game, and complete my initial turn.  The server then does
> one of two things:
> 
> (1) hangs, churning my CPU for as long as I let it.
> (2) gives a segmentation fault and quits.

I think I found a fix for this, but www.freeciv.org seems to be down
at the moment, so here's a patch.  (Though note that one of the fix lines 
here is already in CVS, if it comes back.)

-- David
diff -u -r --exclude-from exclude fc1/server/settlers.c 
freeciv-mod/server/settlers.c
--- fc1/server/settlers.c       Thu Nov 26 20:25:07 1998
+++ freeciv-mod/server/settlers.c       Wed Dec  9 23:02:39 1998
@@ -744,7 +744,7 @@
 /*      y = map_adjust_y(pcity->y + j - 2);     Pernicious! */
       y = pcity->y + j - 2;
       if (map_get_continent(x, y) == co &&
-          (y >= 0 && y < map.xsize) &&
+          (y >= 0 && y < map.ysize) &&
           warmap.cost[x][y] <= THRESHOLD * m &&
           (territory[x][y]&(1<<n)) && /* pretty good, hope it's enough! -- 
Syela */
           !is_already_assigned(punit, pplayer, x, y)) {
@@ -867,7 +867,7 @@
     punit->ai.ai_role = AIUNIT_AUTO_SETTLER; /* here and not before! -- Syela 
*/
     for (j = -11; j <= 11; j++) { /* hope this is far enough -- Syela */
       y = punit->y + j;
-      if (y < 0 || y > map.ysize) continue;
+      if (y < 0 || y >= map.ysize) continue;
       for (i = -11; i <= 11; i++) {
         x = map_adjust_x(punit->x + i);
         w = 0;
@@ -1104,7 +1104,7 @@
 {
   int i, x, y;
   for (x = 0; x < map.xsize; x++)
-    for (y = 0; y < map.xsize; y++)
+    for (y = 0; y < map.ysize; y++)
       map_get_tile(x, y)->assigned = 0;
 
   for (i = 0; i < game.nplayers; i++) {
@@ -1152,7 +1152,7 @@
 { /* this funct is supposed to keep settlers out of enemy territory -- Syela */
   int i, x, y;
   for (x = 0; x < map.xsize; x++)
-    for (y = 0; y < map.xsize; y++)
+    for (y = 0; y < map.ysize; y++)
       territory[x][y] = 65535;
 
   for (i = 0; i < game.nplayers; i++) {

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