Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2000:
[Freeciv-Dev] Re: server removal of unit cleanup
Home

[Freeciv-Dev] Re: server removal of unit cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: server removal of unit cleanup
From: Thue Janus Kristensen <thue@xxxxxxx>
Date: Tue, 23 May 2000 16:45:47 +0200

On Tue, 23 May 2000, Jeff Mallatt wrote:
> At 2000/05/18 16:58 , Thue Janus Kristensen wrote:
> >There can be only one! (function to remove units in the server) -
> >wipeunit()!
> >No need to have others. Much cleaner this way.
> 
> Agree!
> 
> However, this patch results in my favorite regression test (last posted as
> get_def_bugged.sav) causing the server to dump core:
> 
> #0  0x8072c87 in kill_unit (pkiller=0x84299b8, punit=0x84236a8) at
> unitfunc.c:2484
> 2484            notify_player_ex(&game.players[punit2->owner], 
> (gdb) list
> 2479                         _("Game: You lost %d units under an attack"
> 2480                           " from %s's %s%s."),
> 2481                         num_killed, destroyer->name,
> 2482                         unit_name(pkiller->type), loc_str);
> 2483        unit_list_iterate(map_get_tile(punit->x, punit->y)->units,
> punit2) {
> 2484            notify_player_ex(&game.players[punit2->owner], 
> 2485                             punit2->x, punit2->y, E_UNIT_LOST,
> 2486                             _("Game: You lost a%s %s under an attack"
> 2487                               " from %s's %s."),
> 2488
> n_if_vowel(get_unit_type(punit2->type)->name[0]),
> (gdb) print punit2
> $1 = (struct unit *) 0x10
> 
> jjm

Agh - standard corruption of the pointer in unit_list_iterate.
wipe_unit(punit) changed to wipe_unit_spec_safe(punit, NULL,0) to stop
wipe_unit from corrupting the pointer.
Your test game works again now.

-Thue

Attachment: unit_remove-May-23.diff
Description: Text Data


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