<URL: http://bugs.freeciv.org/Ticket/Display.html?id=21843 >
On 1/13/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
> On 1/13/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
> > We have an alliance, but no shared vision. Alliance allows us to see
> > units inside transport. When transport moves out of sight, transported
> > units are not removed.
>
> Patch
>
Untested S2_0 version - I cannot compile S2_0 at the moment.
I have already committed S2_1 and trunk versions.
- ML
diff -Nurd -X.diff_ignore freeciv/server/unittools.c freeciv/server/unittools.c
--- freeciv/server/unittools.c 2007-01-13 00:54:27.000000000 +0200
+++ freeciv/server/unittools.c 2007-01-14 09:55:48.000000000 +0200
@@ -1967,9 +1967,24 @@
|| (pplayer && pplayer->player_no == punit->owner)) {
send_packet_unit_info(pconn, &info);
} else if (pplayer) {
- if (can_player_see_unit_at(pplayer, punit, punit->tile)
- || can_player_see_unit_at(pplayer, punit, ptile)) {
- send_packet_unit_short_info(pconn, &sinfo);
+ bool see_in_old;
+ bool see_in_new = can_player_see_unit_at(pplayer, punit, punit->tile);
+
+ if (punit->tile == ptile) {
+ /* This is not about movement */
+ see_in_old = see_in_new;
+ } else {
+ see_in_old = can_player_see_unit_at(pplayer, punit, ptile);
+ }
+
+ if (see_in_new || see_in_old) {
+ /* First send movement */
+ send_packet_unit_short_info(pconn, &sinfo);
+
+ if (!see_in_new) {
+ /* Then remove unit if necessary */
+ unit_goes_out_of_sight(pplayer, punit);
+ }
if (pplayers_at_war(pplayer,unit_owner(punit))
&& !pplayer->ai.control) {
/* increase_timeout_because_unit_moved(pplayer) possible here */
@@ -2785,17 +2800,6 @@
fog_area(pplayer, psrctile, unit_type(punit)->vision_range);
}
- /*
- * Let the unit goes out of sight for the players which doesn't see
- * the unit anymore.
- */
- players_iterate(pplayer) {
- if (can_player_see_unit_at(pplayer, punit, psrctile)
- && !can_player_see_unit_at(pplayer, punit, pdesttile)) {
- unit_goes_out_of_sight(pplayer, punit);
- }
- } players_iterate_end;
-
/* Remove hidden units (like submarines) which aren't seen anymore. */
square_iterate(psrctile, 1, tile1) {
players_iterate(pplayer) {
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev