Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2005:
[Freeciv-Dev] (PR#14473) civserver segfault
Home

[Freeciv-Dev] (PR#14473) civserver segfault

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#14473) civserver segfault
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Mon, 31 Oct 2005 06:10:13 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14473 >

> Here is a savegame. Conquer Tallinn. Backtrace below.
> 
> Christian
> 
This one was nasty. At first glance, the final assertion in
real_unit_change_homecity seems to be always true:

void real_unit_change_homecity(struct unit *punit, struct city *new_pcity)
{
  struct city *old_pcity = find_city_by_id(punit->homecity);
  struct player *old_owner = unit_owner(punit);
  struct player *new_owner = city_owner(new_pcity);


  if (!same_pos(punit->tile, new_pcity->tile)) {
    assert(can_unit_exist_at_tile(punit, new_pcity->tile));
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 */
    move_unit(punit, new_pcity->tile, 0); /* teleport to location */
  }

  unit_list_prepend(new_pcity->units_supported, punit);
  if (old_pcity) {
    unit_list_unlink(old_pcity->units_supported, punit);
  }
  if (old_owner != new_owner) {
    vision_clear_sight(punit->server.vision);
    vision_free(punit->server.vision);

    ai_reinit(punit);

    unit_list_unlink(old_owner->units, punit);
    unit_list_prepend(new_owner->units, punit);
    punit->owner = new_owner;

    punit->server.vision = vision_new(new_owner, punit->tile, TRUE);
    unit_refresh_vision(punit);
  }

  punit->homecity = new_pcity->id;
  send_unit_info(unit_owner(punit), punit);

  city_refresh(new_pcity);
  send_city_info(new_owner, new_pcity);

  if (old_pcity) {
    assert(city_owner(old_pcity) == old_owner);
    city_refresh(old_pcity);
    send_city_info(old_owner, old_pcity);
  }
  assert(unit_owner(punit) == city_owner(new_pcity));
}

But a unit which is placed outside the city conquers it back when we 
teleport it in the line marked with /* !!!!!! */.
The unit sill belongs to the old owner in that line.

Any solutions?
--
mateusz



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