Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10531) crash with connect-road
Home

[Freeciv-Dev] (PR#10531) crash with connect-road

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10531) crash with connect-road
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Oct 2004 14:54:26 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10531 >

I was playing for a little while with the civ3gfx tileset, then did 
connect-road with a worker unit and promptly got a crash.

civclient: goto.c:658: fill_client_goto_parameter: Assertion 
`connect_initial >= 0' failed.

#5  0x4071db3f in *__GI___assert_fail (assertion=0x0, file=0x0, line=0,
     function=0x8146192 "fill_client_goto_parameter") at assert.c:83
#6  0x0807879b in fill_client_goto_parameter (punit=0x828d958,
     parameter=0x8166ef0) at goto.c:658
#7  0x080788cb in enter_goto_state (punit=0x828d958) at goto.c:696
#8  0x0807561a in request_unit_connect (activity=ACTIVITY_ROAD)
     at control.c:701
#9  0x08076f34 in key_unit_connect (activity=ACTIVITY_ROAD) at 
control.c:1829

(gdb) select 6
(gdb) p connect_initial
$1 = -1
(gdb) p punit->tile->terrain
$2 = 8
(gdb) p punit->tile->special
$4 = 514
(gdb) p punit->tile->special & S_RIVER
$5 = 512
(gdb) p punit->tile->city
$1 = (struct city *) 0x828d6b0
(gdb) p punit->tile->special & S_ROAD
$2 = 2

So the worker unit is on a tile with a river and a road (from a city). 
connect_initial erronously returns -1 here (because bridge-building is 
not known); it should return 0 because the activity is already competed.

This patch fixes it.

jason

? newtiles
Index: client/goto.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/goto.c,v
retrieving revision 1.75
diff -u -r1.75 goto.c
--- client/goto.c       14 Oct 2004 21:01:04 -0000      1.75
+++ client/goto.c       14 Oct 2004 21:52:50 -0000
@@ -412,13 +412,13 @@
     break;
   case ACTIVITY_RAILROAD:
   case ACTIVITY_ROAD:
-    if (ttype->road_time == 0
-        || (tile_has_special(ptile, S_RIVER)
-            && !player_knows_techs_with_flag(pplayer, TF_BRIDGE))) {
-      /* 0 means road is impossible here (??) */
-      return -1;
-    }
     if (!tile_has_special(ptile, S_ROAD)) {
+      if (ttype->road_time == 0
+         || (tile_has_special(ptile, S_RIVER)
+             && !player_knows_techs_with_flag(pplayer, TF_BRIDGE))) {
+       /* 0 means road is impossible here (??) */
+       return -1;
+      }
       activity_mc += ttype->road_time;
     }
     if (connect_activity == ACTIVITY_ROAD 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10531) crash with connect-road, Jason Short <=