Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] Re: (PR#5789) Don't send info about transported units to c
Home

[Freeciv-Dev] Re: (PR#5789) Don't send info about transported units to c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#5789) Don't send info about transported units to clients without shared vision
From: "Rafa³ Bursig" <bursig@xxxxxxxxx>
Date: Sun, 21 Sep 2003 06:19:32 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Hi All

This is next version of this patch.

Curret this code sent load/unload transporter info to clients and fix 
move animation problem.
Additionaly (bool)unit->client.occupied is changed to (int)unit->occupy 
and send to client. This change allow easy add subtranspor support on 
server and client get current ocuppy number (other players get only 0/1 
info)

Rafal
diff -u -r freeciv/client/control.c fc/client/control.c
--- freeciv/client/control.c    2003-09-18 14:34:48.000000000 +0200
+++ fc/client/control.c 2003-09-21 14:01:32.691871120 +0200
@@ -344,12 +344,14 @@
      (always return first in stack). */
   unit_list_iterate(ptile->units, punit)
     if (unit_owner(punit) == game.player_ptr) {
-      if (get_transporter_capacity(punit) > 0) {
-       return punit;
-      } else if (!panyowned) {
-       panyowned = punit;
+      if (!punit->transported_by) {
+        if (get_transporter_capacity(punit) > 0) {
+         return punit;
+        } else if (!panyowned) {
+         panyowned = punit;
+        }
       }
-    } else if (!ptptother &&
+    } else if (!ptptother && !punit->transported_by &&
               player_can_see_unit(game.player_ptr, punit)) {
       if (get_transporter_capacity(punit) > 0) {
        ptptother = punit;
@@ -1361,14 +1363,15 @@
     return;
   }
   
-  if(unit_list_size(&ptile->units) == 1) {
+  if (unit_list_size(&ptile->units) == 1
+      && !unit_list_get(&ptile->units, 0)->occupy) {
     struct unit *punit=unit_list_get(&ptile->units, 0);
     if(game.player_idx==punit->owner) {
       if(can_unit_do_activity(punit, ACTIVITY_IDLE)) {
        set_unit_focus_and_select(punit);
       }
     }
-  } else if(unit_list_size(&ptile->units) >= 2) {
+  } else if(unit_list_size(&ptile->units) > 0) {
     /* The stack list is always popped up, even if it includes enemy units.
      * If the server doesn't want the player to know about them it shouldn't
      * tell him!  The previous behavior would only pop up the stack if you
diff -u -r freeciv/client/gui-sdl/menu.c fc/client/gui-sdl/menu.c
--- freeciv/client/gui-sdl/menu.c       2003-08-31 22:57:34.000000000 +0200
+++ fc/client/gui-sdl/menu.c    2003-09-21 13:56:33.000000000 +0200
@@ -1143,7 +1143,7 @@
        local_hide(ID_UNIT_ORDER_HOMECITY);
       }
 
-      if (get_transporter_capacity(pUnit) > 0) {
+      if (get_transporter_capacity(pUnit) > 0 && pUnit->occupy) {
        local_show(ID_UNIT_ORDER_UNLOAD);
       } else {
        local_hide(ID_UNIT_ORDER_UNLOAD);
diff -u -r freeciv/client/mapview_common.c fc/client/mapview_common.c
--- freeciv/client/mapview_common.c     2003-08-13 08:09:31.000000000 +0200
+++ fc/client/mapview_common.c  2003-09-21 14:03:06.491611392 +0200
@@ -416,9 +416,9 @@
              int unit_offset_x, int unit_offset_y,
              int unit_width, int unit_height)
 {
-  struct drawn_sprite sprites[40];
+  struct drawn_sprite drawn_sprites[40];
   bool solid_bg;
-  int count = fill_unit_sprite_array(sprites, punit, &solid_bg), i;
+  int count = fill_unit_sprite_array(drawn_sprites, punit, &solid_bg), i;
 
   if (!is_isometric && solid_bg) {
     gui_put_rectangle(pcanvas_store, player_color(unit_owner(punit)),
@@ -426,16 +426,22 @@
   }
 
   for (i = 0; i < count; i++) {
-    if (sprites[i].sprite) {
-      int ox = sprites[i].offset_x, oy = sprites[i].offset_y;
+    if (drawn_sprites[i].sprite) {
+      int ox = drawn_sprites[i].offset_x, oy = drawn_sprites[i].offset_y;
 
       /* units are never fogged */
       gui_put_sprite(pcanvas_store, canvas_x + ox, canvas_y + oy,
-                    sprites[i].sprite,
+                    drawn_sprites[i].sprite,
                     unit_offset_x - ox, unit_offset_y - oy,
                     unit_width - ox, unit_height - oy);
     }
   }
+
+  if (punit->occupy) {
+    gui_put_sprite(pcanvas_store, canvas_x, canvas_y,
+                  sprites.unit.stack,
+                  unit_offset_x, unit_offset_y, unit_width, unit_height);
+  }
 }
 
 /**************************************************************************
diff -u -r freeciv/client/packhand.c fc/client/packhand.c
--- freeciv/client/packhand.c   2003-09-18 14:34:48.000000000 +0200
+++ fc/client/packhand.c        2003-09-21 14:04:00.366421176 +0200
@@ -73,7 +73,7 @@
 
 static void handle_city_packet_common(struct city *pcity, bool is_new,
                                       bool popup, bool investigate);
-static void handle_unit_packet_common(struct unit *packet_unit, bool carried);
+static bool handle_unit_packet_common(struct unit *packet_unit, bool carried);
 static int *reports_thaw_requests = NULL;
 static int reports_thaw_requests_size = 0;
 
@@ -109,7 +109,12 @@
   punit->activity_target = packet->activity_target;
   punit->paradropped = packet->paradropped;
   punit->connecting = packet->connecting;
-
+  punit->occupy = packet->occupy;
+  if (packet->carried) {
+    punit->transported_by = 1;
+  } else {
+    punit->transported_by = 0;
+  }
   return punit;
 }
 
@@ -130,7 +135,9 @@
   punit->veteran = packet->veteran;
   punit->hp = packet->hp;
   punit->activity = packet->activity;
-
+  punit->occupy = (packet->occupied ? 1 : 0);
+  punit->transported_by = 0;
+  
   return punit;
 }
 
@@ -869,14 +876,15 @@
   }
 
   punit = unpackage_unit(packet);
-  handle_unit_packet_common(punit, packet->carried);
-  free(punit);
+  if (handle_unit_packet_common(punit, packet->carried)) {
+    free(punit);
+  }
 }
 
 /**************************************************************************
   Called to do basic handling for a unit_info or short_unit_info packet.
 **************************************************************************/
-static void handle_unit_packet_common(struct unit *packet_unit, bool carried)
+static bool handle_unit_packet_common(struct unit *packet_unit, bool carried)
 {
   struct city *pcity;
   struct unit *punit;
@@ -885,13 +893,17 @@
   int old_x = -1, old_y = -1;  /* make compiler happy; guarded by moved */
   bool check_focus = FALSE;     /* conservative focus change */
   bool moved = FALSE;
-
+  bool ret = FALSE;
+  
   punit = player_find_unit_by_id(get_player(packet_unit->owner),
                                 packet_unit->id);
 
   if (punit) {
     int dest_x, dest_y;
+    ret = TRUE;
     punit->activity_count = packet_unit->activity_count;
+    punit->transported_by = packet_unit->transported_by;
+    punit->occupy = packet_unit->occupy;
     if (punit->ai.control != packet_unit->ai.control) {
       punit->ai.control = packet_unit->ai.control;
       repaint_unit = TRUE;
@@ -1010,7 +1022,7 @@
         * a phantom (incorrect/imaginary) unit. */
        client_remove_unit(punit);
        refresh_tile_mapcanvas(packet_unit->x, packet_unit->y, FALSE);
-        return;
+        return ret;
       }
 
       update_unit_focus();
@@ -1097,8 +1109,7 @@
     agents_unit_changed(punit);
   } else {
     /* create new unit */ 
-    punit = fc_malloc(sizeof(struct unit));
-    *punit = *packet_unit;
+    punit = packet_unit;
     idex_register_unit(punit);
 
     unit_list_insert(&get_player(punit->owner)->units, punit);
@@ -1137,7 +1148,9 @@
     refresh_tile_mapcanvas(punit->x, punit->y, FALSE);
 
   if (check_focus || get_unit_in_focus() == NULL)
-    update_unit_focus(); 
+    update_unit_focus();
+  
+  return ret;
 }
 
 /**************************************************************************
@@ -1193,8 +1206,9 @@
   }
 
   punit = unpackage_short_unit(packet);
-  handle_unit_packet_common(punit, packet->carried);
-  free(punit);
+  if (handle_unit_packet_common(punit, packet->carried)) {
+    free(punit);
+  }
 }
 
 /**************************************************************************
diff -u -r freeciv/client/tilespec.c fc/client/tilespec.c
--- freeciv/client/tilespec.c   2003-08-28 16:58:42.000000000 +0200
+++ fc/client/tilespec.c        2003-09-21 14:05:41.140101248 +0200
@@ -2079,8 +2079,10 @@
     if (punit && (draw_units || (draw_focus_unit && pfocus == punit))) {
       sprs += fill_unit_sprite_array(sprs, punit, solid_bg);
       *pplayer = unit_owner(punit);
-      if (unit_list_size(&ptile->units) > 1)  
+      if (unit_list_size(&ptile->units) > 1
+         || unit_list_get(&ptile->units, 0)->occupy) {
        ADD_SPRITE_SIMPLE(sprites.unit.stack);
+      }
       return sprs - save_sprs;
     }
 
@@ -2234,7 +2236,8 @@
        no_backdrop = (pcity != NULL);
        sprs += fill_unit_sprite_array(sprs, punit, &dummy);
        no_backdrop = FALSE;
-       if (unit_list_size(&ptile->units) > 1) {  
+       if (unit_list_size(&ptile->units) > 1
+           || unit_list_get(&ptile->units, 0)->occupy) {
          ADD_SPRITE_SIMPLE(sprites.unit.stack);
        }
       }
diff -u -r freeciv/common/capstr.c fc/common/capstr.c
--- freeciv/common/capstr.c     2003-09-14 13:08:42.000000000 +0200
+++ fc/common/capstr.c  2003-09-20 15:43:53.000000000 +0200
@@ -80,7 +80,7 @@
                    "+no_nation_selected +diplomacy +no_extra_tiles " \
                    "+diplomacy2 +citizens_style +root_tech auth " \
                    "+nat_ulimit +retake +goto_pack borders dip " \
-                   "+packet_short_unit"
+                   "+packet_short_unit +unit_occupied"
 
 /* "+1.14.0" is protocol for 1.14.0 release.
  *
@@ -149,6 +149,9 @@
  *
  * "packet_short_unit" is packet sent instead of full packet_unit_info to
  * enemies, so that not all info about the unit is sent.
+ *
+ * "unit_occupied" means units occupying transporters are not sent to enemies.
+ * instead an 'occupied' flag is set for the transporter.
  */
 
 void init_our_capability(void)
Tylko w fc/common: capstr.o
diff -u -r freeciv/common/packets.c fc/common/packets.c
--- freeciv/common/packets.c    2003-09-18 14:34:50.000000000 +0200
+++ fc/common/packets.c 2003-09-21 13:56:37.000000000 +0200
@@ -1278,7 +1278,8 @@
 
   dio_put_uint16(&dout, req->id);
   dio_put_uint8(&dout, req->owner);
-  pack = (COND_SET_BIT(req->carried, 3) |
+  pack = (COND_SET_BIT((req->occupy > 0), 2) |
+          COND_SET_BIT(req->carried, 3) |
          COND_SET_BIT(req->veteran, 4) |
          COND_SET_BIT(req->ai, 5) |
          COND_SET_BIT(req->paradropped, 6) |
@@ -1299,7 +1300,9 @@
   dio_put_uint8(&dout, req->goto_dest_x);
   dio_put_uint8(&dout, req->goto_dest_y);
   dio_put_uint16(&dout, req->activity_target);
-
+  if (req->occupy > 0) {
+    dio_put_uint8(&dout, req->occupy);
+  }
   if (req->fuel > 0)
     dio_put_uint8(&dout, req->fuel);
 
@@ -1557,7 +1560,6 @@
   dio_get_uint16(&din, &packet->id);
   dio_get_uint8(&din, &packet->owner);
   dio_get_uint8(&din, &pack);
-
   packet->carried = TEST_BIT(pack, 3);
   packet->veteran = TEST_BIT(pack, 4);
   packet->ai = TEST_BIT(pack, 5);
@@ -1578,7 +1580,11 @@
   dio_get_uint8(&din, &packet->goto_dest_x);
   dio_get_uint8(&din, &packet->goto_dest_y);
   dio_get_uint16(&din, (int *) &packet->activity_target);
-
+  if (TEST_BIT(pack, 2)) {
+    dio_get_uint8(&din, &packet->occupy);
+  } else {
+    packet->occupy = 0;
+  }
   if (dio_input_remaining(&din) >= 1) {
     dio_get_uint8(&din, &packet->fuel);
   } else {
@@ -1980,7 +1986,8 @@
   dio_put_uint8(&dout, req->activity);
 
   pack = (COND_SET_BIT(req->carried, 3)
-         | COND_SET_BIT(req->veteran, 4));
+         | COND_SET_BIT(req->veteran, 4)
+         | COND_SET_BIT(req->occupied, 5));
   dio_put_uint8(&dout, pack);
 
   dio_put_uint8(&dout, req->packet_use);
@@ -2010,6 +2017,7 @@
   dio_get_uint8(&din, &pack);
   packet->carried = TEST_BIT(pack, 3);
   packet->veteran = TEST_BIT(pack, 4);
+  packet->occupied = TEST_BIT(pack, 5);
 
   dio_get_uint8(&din, &packet->packet_use);
   dio_get_uint16(&din, &packet->info_city_id);
diff -u -r freeciv/common/packets.h fc/common/packets.h
--- freeciv/common/packets.h    2003-09-18 14:34:50.000000000 +0200
+++ fc/common/packets.h 2003-09-21 13:37:30.007192528 +0200
@@ -327,7 +327,7 @@
   enum tile_special_type activity_target;
   bool paradropped;
   bool connecting;
-
+  int occupy;
   /* in packet only, not in unit struct */
   bool carried;                /* FIXME: should not send carried units at all? 
*/
 };
@@ -345,6 +345,7 @@
   int type;
   int hp;
   int activity;
+  bool occupied;
 
   /* in packet only, not in unit struct */
   int carried;         /* FIXME: should not send carried units at all? */
Tylko w fc/common: packets_lsend.o
Tylko w fc/common: packets.o
diff -u -r freeciv/common/player.c fc/common/player.c
--- freeciv/common/player.c     2003-08-16 22:23:19.000000000 +0200
+++ fc/common/player.c  2003-09-21 11:16:56.000000000 +0200
@@ -235,15 +235,14 @@
   /* Search for units/cities that might be able to see the sub/missile */
   adjc_iterate(x, y, x1, y1) {
     struct city *pcity = map_get_city(x1, y1);
+    if (pcity && pplayers_allied(city_owner(pcity), pplayer)) {
+      return TRUE;
+    }  
     unit_list_iterate(map_get_tile(x1, y1)->units, punit2) {
       if (pplayers_allied(unit_owner(punit2), pplayer)) {
        return TRUE;
       }
     } unit_list_iterate_end;
-
-    if (pcity && pplayers_allied(city_owner(pcity), pplayer)) {
-      return TRUE;
-    }
   } adjc_iterate_end;
 
   return FALSE;
@@ -264,7 +263,7 @@
   (a) can see the tile AND
   (b) can see the unit at the tile (i.e. unit not invisible at this tile) AND
   (c) the unit is not in an unallied city
-
+  
   TODO: the name is confusingly similar to player_can_see_unit_at_location
   But we need to rename p_c_s_u_a_t because it is really 
   is_unit_visible_to_player_at or player_ignores_unit_invisibility_at.
@@ -272,12 +271,9 @@
 bool can_player_see_unit_at(struct player *pplayer, struct unit *punit,
                             int x, int y)
 {
-  bool see_tile = (map_get_known2(x, y, pplayer) == TILE_KNOWN);
-  bool see_unit = player_can_see_unit_at_location(pplayer, punit, x, y);
-  struct city *pcity = map_get_city(x, y);
-  bool in_city = (pcity && !pplayers_allied(unit_owner(punit), pplayer));
-  
-  return (see_tile && see_unit && !in_city);
+  return ((map_get_known2(x, y, pplayer) == TILE_KNOWN)
+         && !(map_get_city(x, y) && !pplayers_allied(unit_owner(punit), 
pplayer))
+         && player_can_see_unit_at_location(pplayer, punit, x, y));
 }
 
 /***************************************************************
diff -u -r freeciv/common/unit.c fc/common/unit.c
--- freeciv/common/unit.c       2003-08-26 18:26:41.000000000 +0200
+++ fc/common/unit.c    2003-09-21 13:41:08.000000000 +0200
@@ -1481,6 +1481,7 @@
   punit->ord_map = 0;
   punit->ord_city = 0;
   set_unit_activity(punit, ACTIVITY_IDLE);
+  punit->occupy = 0;
 
   return punit;
 }
diff -u -r freeciv/common/unit.h fc/common/unit.h
--- freeciv/common/unit.h       2003-08-26 18:26:41.000000000 +0200
+++ fc/common/unit.h    2003-09-21 13:34:59.011147416 +0200
@@ -118,7 +118,6 @@
   int upkeep;
   int upkeep_food;
   int upkeep_gold;
-  bool foul;
   int fuel;
   int bribe_cost;
   struct unit_ai ai;
@@ -133,10 +132,12 @@
   int ord_map, ord_city;
   /* ord_map and ord_city are the order index of this unit in tile.units
      and city.units_supported; they are only used for save/reload */
+  bool foul;
   bool moved;
   bool paradropped;
   bool connecting;
   int transported_by;
+  int occupy; /* number of units that occupy transporter */
   struct goto_route *pgr;
 };
 
diff -u -r freeciv/server/unithand.c fc/server/unithand.c
--- freeciv/server/unithand.c   2003-09-21 14:09:46.798755456 +0200
+++ fc/server/unithand.c        2003-09-21 11:59:28.000000000 +0200
@@ -1473,9 +1473,9 @@
       free(punit->pgr);
       punit->pgr = NULL;
     }
-
-    send_unit_info_to_onlookers(NULL, punit, punit->x, punit->y, FALSE);
-
+    
+    send_unit_info(NULL, punit);
+    
     handle_unit_activity_dependencies(punit, old_activity, old_target);
   }
 }
Tylko w fc/server: unithand.o
diff -u -r freeciv/server/unittools.c fc/server/unittools.c
--- freeciv/server/unittools.c  2003-09-21 14:09:46.888741776 +0200
+++ fc/server/unittools.c       2003-09-21 13:43:42.000000000 +0200
@@ -1831,6 +1830,7 @@
   packet->paradropped = punit->paradropped;
   packet->connecting = punit->connecting;
   packet->carried = carried;
+  packet->occupy = get_transporter_occupancy(punit);
 }
 
 /**************************************************************************
@@ -1862,7 +1862,7 @@
   packet->veteran = punit->veteran;
   packet->type = punit->type;
   packet->hp = punit->hp;
-
+  packet->occupied = (get_transporter_occupancy(punit) > 0);
   if (punit->activity == ACTIVITY_GOTO
       || punit->activity == ACTIVITY_EXPLORE
       || punit->activity == ACTIVITY_PATROL) {
@@ -1882,11 +1882,13 @@
   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)
+                                int x, int y, bool remove_unseen)
 {
   struct packet_unit_info info;
   struct packet_short_unit sinfo;
-
+  struct packet_generic_integer packet; 
+  bool carried = punit->transported_by != -1;
+  
   if (!dest) {
     dest = &game.game_connections;
   }
@@ -1894,21 +1896,32 @@
   package_unit(punit, &info, carried);
   package_short_unit(punit, &sinfo, carried,
                     UNIT_INFO_IDENTITY, FALSE, FALSE);
-
+  packet.value = punit->id;
+            
   conn_list_iterate(*dest, pconn) {
     struct player *pplayer = pconn->player;
-    bool see_pos =
-       can_player_see_unit_at(pplayer, punit, punit->x, punit->y);
-    bool see_xy = see_pos;
-
-    if (!same_pos(x, y, punit->x, punit->y)) {
-      see_xy = can_player_see_unit_at(pplayer, punit, x, y);
-    }
+    
     if ((!pplayer && pconn->observer) 
        || pplayer->player_no == punit->owner) {
       send_packet_unit_info(pconn, &info);
-    } else if (see_pos || see_xy) {
-      send_packet_short_unit(pconn, &sinfo);
+    } else {
+      bool see_unit = (!carried || (carried
+                       && gives_shared_vision(unit_owner(punit), pplayer)));
+      bool see_pos = see_unit 
+       && can_player_see_unit_at(pplayer, punit, punit->x, punit->y);
+      bool see_xy = see_pos;
+
+      if (see_unit && !same_pos(x, y, punit->x, punit->y)) {
+        see_xy = can_player_see_unit_at(pplayer, punit, x, y);
+      }
+      
+      if (see_pos || see_xy) {
+        send_packet_short_unit(pconn, &sinfo);
+      } else {
+       if (remove_unseen) {
+         send_packet_generic_integer(pconn, PACKET_REMOVE_UNIT, &packet);
+       }
+      }
     }
   } conn_list_iterate_end;
 }
@@ -1956,10 +1969,6 @@
 }
 
 
-
-
-
-
 /**************************************************************************
 For all units which are transported by the given unit and that are
 currently idle, sentry them.
@@ -2812,7 +2821,8 @@
   struct tile *psrctile = map_get_tile(src_x, src_y);
   struct tile *pdesttile = map_get_tile(dest_x, dest_y);
   struct city *pcity;
-
+  struct unit *ptransporter = NULL;
+    
   CHECK_MAP_POS(dest_x, dest_y);
 
   conn_list_do_buffer(&pplayer->connections);
@@ -2881,7 +2891,7 @@
 
       unit_list_insert(&pdesttile->units, pcargo);
       check_unit_activity(pcargo);
-      send_unit_info_to_onlookers(NULL, pcargo, src_x, src_y, TRUE);
+      send_unit_info_to_onlookers(NULL, pcargo, src_x, src_y, FALSE);
       fog_area(unit_owner(pcargo), src_x, src_y, 
unit_type(pcargo)->vision_range);
       handle_unit_move_consequences(pcargo, src_x, src_y, dest_x, dest_y);
     } unit_list_iterate_end;
@@ -2907,22 +2917,46 @@
   punit->x = dest_x;
   punit->y = dest_y;
   punit->moved = TRUE;
+  if (punit->transported_by != -1) {
+    ptransporter = find_unit_by_id(punit->transported_by);
+  }
   punit->transported_by = -1;
   punit->moves_left = MAX(0, punit->moves_left - move_cost);
   unit_list_insert(&pdesttile->units, punit);
   check_unit_activity(punit);
 
+  /*
+   * Transporter info should be send first becouse this allow us get right
+   * update_menu effect in client side.
+   */
+  
+  /*
+   * Send updated information to anyone watching that transporter was unload
+   * cargo.
+   */
+  if (ptransporter) {
+    send_unit_info(NULL, ptransporter);
+  }
+  
+  /* Send updated information to anyone watching.  If the unit moves
+   * in or out of a city we update the 'occupied' field.  Note there may
+   * be cities at both src and dest under some rulesets. */
+  send_unit_info_to_onlookers(NULL, punit, src_x, src_y, FALSE);
+    
   /* Special checks for ground units in the ocean. */
   if (!pdesttile->city
       && is_ground_unit(punit)
       && is_ocean(pdesttile->terrain)) {
-
+       
+    ptransporter = NULL;
+       
     /* Find a transporter for the unit. */
     unit_list_iterate(map_get_tile(punit->x, punit->y)->units, ptrans) {
       if (is_ground_units_transport(ptrans)
          && (get_transporter_occupancy(ptrans)
              < get_transporter_capacity(ptrans))) {
        punit->transported_by = ptrans->id;
+       ptransporter = ptrans;
        break;
       }
     } unit_list_iterate_end;
@@ -2938,12 +2972,25 @@
                          dest_x, dest_y))) {
       set_unit_activity(punit, ACTIVITY_SENTRY);
     }
-  }
 
-  /* Send updated information to anyone watching.  If the unit moves
-   * in or out of a city we update the 'occupied' field.  Note there may
-   * be cities at both src and dest under some rulesets. */
-  send_unit_info_to_onlookers(NULL, punit, src_x, src_y, FALSE);
+    /*
+     * Transporter info should be send first becouse this allow us get right
+     * update_menu effect in client side.
+     */
+    
+    /*
+     * Send updated information to anyone watching that transporter has cargo.
+     */    
+    send_unit_info(NULL, ptransporter);
+    
+    /*
+     * Send updated information to anyone watching that unit is on transport.
+     * All players without shared vison with owner player get
+     * REMOVE_UNIT package.
+     */
+    send_unit_info_to_onlookers(NULL, punit, punit->x, punit->x, TRUE);    
+  }
+  
   if ((pcity = map_get_city(src_x, src_y))) {
     refresh_dumb_city(pcity);
   }
diff -u -r freeciv/server/unittools.h fc/server/unittools.h
--- freeciv/server/unittools.h  2003-09-20 11:39:42.000000000 +0200
+++ fc/server/unittools.h       2003-09-21 11:54:23.000000000 +0200
@@ -71,7 +71,7 @@
                        int info_city_id, bool new_serial_num);
 void send_unit_info(struct player *dest, struct unit *punit);
 void send_unit_info_to_onlookers(struct conn_list *dest, struct unit *punit, 
-                                int x, int y, bool carried);
+                                int x, int y, bool remove_unseen);
 void send_all_known_units(struct conn_list *dest);
 
 

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