Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2005:
[Freeciv-Dev] (PR#14649) Assertion Failure, packhand.c handle_tile_info
Home

[Freeciv-Dev] (PR#14649) Assertion Failure, packhand.c handle_tile_info

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: badamson@xxxxxxxxxxx, chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#14649) Assertion Failure, packhand.c handle_tile_info - ghost units
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Nov 2005 14:47:38 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Here's an update of the ghost-units fix, with a comment explaining the
problem with the current code.  I will commit this shortly.

-jason

Index: server/unittools.c
===================================================================
--- server/unittools.c  (revision 11260)
+++ server/unittools.c  (working copy)
@@ -1375,7 +1375,18 @@
 
   conn_list_iterate(game.est_connections, pconn) {
     if ((!pconn->player && pconn->observer)
-       || can_player_see_unit(pconn->player, punit)) {
+       || map_is_known_and_seen(punit->tile, pconn->player, V_MAIN)) {
+      /* FIXME: this sends the remove packet to all players, even those who
+       * can't see the unit.  This potentially allows some limited cheating.
+       * However fixing it requires changes elsewhere since sometimes the
+       * client is informed about unit disappearance only after the unit
+       * disappears.  For instance when building a city the settler unit
+       * is wiped only after the city is built...at which point the settler
+       * is already "hidden" inside the city and can_player_see_unit would
+       * return FALSE.  One possible solution is to have a bv_player for
+       * each unit to record which players (clients) currently know about
+       * the unit; then we could just use a BV_TEST here and not have to
+       * worry about any synchronization problems. */
       dsend_packet_unit_remove(pconn, punit->id);
     }
   } conn_list_iterate_end;

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