[Freeciv-Dev] Re: (PR#9540) GHOST UNITS again!
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: (PR#9540) GHOST UNITS again! |
From: |
"Mateusz Stefek" <mstefek@xxxxxxxxx> |
Date: |
Thu, 29 Jul 2004 04:03:10 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9540 >
> load attached game
>
> connect as A and B (with two clients)
> 1) move A's destroyer east
> There's already bug here. A shouldn't see this submarine. But this is
>
> harmless
> 2) move B's submarine west and disband it.
> Now there is a ghost unit in A's client.
> --
> mateusz
>
And a fix
--
mateusz
? civgame+1553.sav.gz
? civgame+1554.sav.gz
? civgame+1555.sav.gz
? civgame+1556.sav.gz
? civgame+1557.sav.gz
? civgame+1558.sav.gz
? civgame-3500.sav.gz
? civgame-3950.sav.gz
Index: unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.294
diff -u -r1.294 unittools.c
--- unittools.c 1 Jun 2004 19:44:24 -0000 1.294
+++ unittools.c 29 Jul 2004 11:00:33 -0000
@@ -2817,6 +2817,21 @@
unit_goes_out_of_sight(pplayer, punit);
}
} players_iterate_end;
+
+ /*
+ * Remove all hidden units which aren't seen anymore. Note that
+ * can_player_see_unit() checks if the player can see a tile and
+ * that's why this code won't produce unnecessary network traffic.
+ */
+ square_iterate(src_x, src_y, 1, n_x, n_y) {
+ players_iterate(pplayer) {
+ unit_list_iterate(map_get_tile(n_x, n_y)->units, punit2) {
+ if (punit2 != punit && !can_player_see_unit(pplayer, punit2)) {
+ unit_goes_out_of_sight(pplayer, punit2);
+ }
+ } unit_list_iterate_end;
+ } players_iterate_end;
+ } square_iterate_end;
handle_unit_move_consequences(punit, src_x, src_y, dest_x, dest_y);
wakeup_neighbor_sentries(punit);
- [Freeciv-Dev] Re: (PR#9540) GHOST UNITS again!,
Mateusz Stefek <=
|
|