Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2002:
[Freeciv-Dev] Re: cma bug? (PR#1864) + stealth fighter bug
Home

[Freeciv-Dev] Re: cma bug? (PR#1864) + stealth fighter bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: cma bug? (PR#1864) + stealth fighter bug
From: Mateusz Stefek <matusik_s@xxxxx>
Date: Wed, 7 Aug 2002 18:39:09 +0200

On Mon, Aug 05, 2002 at 02:49:09PM +0300, Jussi Asp wrote:
> Other bug we saw was ghost-stealth fighters, which were seen on map
but
> they weren't there if you tried to attack them, and they stayed
there
> for many turns. Or maybe it's a feature, how is stealth supposed to
> work, I don't know..

        It's not how stealth is supposed to work.
        That said, there may be many different ways such a bug could
come
about.  Units which were sighted, avoided, and are now in a
non-updated or
Fog of War-covered area should remain visible on the map until that
tile is
sighted again and they are proven to be gone.  Something might be
failing
to remove units in the proof stage.
        There have been examples in the past of people mistyping
X-axis and
Y-axis coordinate references.  We might have such a transposition
somewhere
in the current client.

        I consider both of these unlikely, but they are both obvious
explanations for behavior similar to what you describe.


Take a look at server/unittools.c:1998 : /************************************************************************** Send the unit into to those connections in dest which can see the units
  position, or the specified (x,y) (if different).
  Eg, use x and y as where the unit came from, so that the info can be
sent if the other players can see either the target or destination tile.
  dest = NULL means all connections (game.game_connections)
**************************************************************************/
void send_unit_info_to_onlookers(struct conn_list *dest, struct unit *punit, int x, int y, bool carried, bool select_it)
{
  struct packet_unit_info info;

  if (!dest) dest = &game.game_connections;
    package_unit(punit, &info, carried, select_it,
               UNIT_INFO_IDENTITY, FALSE, FALSE);

  conn_list_iterate(*dest, pconn) {
    struct player *pplayer = pconn->player;
    if (!pplayer && !pconn->observer) continue;
!!!!!! if (!pplayer || ((map_get_known_and_seen(info.x, info.y, pplayer)
                      || map_get_known_and_seen(x, y, pplayer))
                     && player_can_see_unit(pplayer, punit))) {
      send_packet_unit_info(pconn, &info);!!!!!!!!!
    }
  }
  conn_list_iterate_end;
}

send_unit_info_to_onlookers() is called from move_unit() with x = src_x and y = src_y. if *pplayer can_see_unit on (src_x, src_y) but !can_see_unit now he doesn't receive it's info. So the client thinks that the unit stays on (src_x, src_y) until it
receives new unit info(sometimes it's impossible).

See the patch
--
mateusz

Attachment: ghost-unit1.diff
Description: Binary data


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