Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] (PR#5642) [BUG] resolve_unit_stacks crashes server
Home

[Freeciv-Dev] (PR#5642) [BUG] resolve_unit_stacks crashes server

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#5642) [BUG] resolve_unit_stacks crashes server
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sun, 31 Aug 2003 08:32:23 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Hi,

Error message:

0: Sancho I's Howitzer (id 281) left a unit stranded in the ocean without 
a transport at position (22, 30). Capacity on old tile is -5  and 5 on new 
tile, which is at position (27, 36). ransport_units is false

Save game: 

Will be added to RT ticket directly

Backtrace:

#4  0x0804b63d in die () at shared.c:662
#5  0x0805f41d in move_unit (punit=0x85838c0, dest_x=27, dest_y=36, 
    transport_units=false, take_from_land=false, move_cost=0) 
    at unittools.c:2907 
#6  0x0805b88b in teleport_unit_to_city (punit=0x85838c0, pcity=0x852a430, 
    move_cost=0, verbose=false) at unittools.c:1301
#7  0x0805b8e4 in bounce_unit (punit=0x85838c0, verbose=false) at 
    unittools.c:1316
#8  0x0805bb52 in resolve_unit_stacks (pplayer=0x816a0ac, 
    aplayer=0x81894ac, verbose=false) at unittools.c:1372
#9  0x0807f75e in civil_war (pplayer=0x816a0ac) at plrhand.c:1823

The problem:

resolve_unit_stacks uses teleport_unit_to_city (via bounce_unit) which in
turn uses move_unit.  It is move_unit which crashes, if the transport was
teleported before the passenger.  There are two possible solutions:

* change move_unit to not do the checks, possibly depending on a bool 
argument.

* change resolve_unit_stacks to process all non-transports first.

I prefer the second solution.  It also appears that it is better to use 
unit_list_iterate_safe in the inner loop of resolve_stacks.  Sometimes the 
units get disbanded.

G.




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#5642) [BUG] resolve_unit_stacks crashes server, Gregory Berkolaiko <=