Author: jtn
Date: Sun Apr 19 14:51:16 2015
New Revision: 28810

URL: http://svn.gna.org/viewcvs/freeciv?rev=28810&view=rev
Log:
Fix bug preventing server sending information about transporter units
before cargo.

This was causing the client's unit selection dialog not to show all of a
transporter's cargo.

Reported by Christian Knoke (chrisk@gna).

See gna bug #23444.

Modified:
    branches/S2_5/client/packhand.c
    branches/S2_5/server/unittools.c

Modified: branches/S2_5/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/packhand.c?rev=28810&r1=28809&r2=28810&view=diff
==============================================================================
--- branches/S2_5/client/packhand.c     (original)
+++ branches/S2_5/client/packhand.c     Sun Apr 19 14:51:16 2015
@@ -1614,7 +1614,10 @@
     repaint_unit = !unit_transported(punit);
     agents_unit_new(punit);
 
-    /* Check if we should link cargo units. */
+    /* Check if we should link cargo units.
+     * (This should only be necessary for allied cargo; for
+     * cargo/transporter of the same nation, server should have sent
+     * transporter info first, per send_unit_info().) */
     if (client_has_player()
         && unit_owner(punit) != client_player()
         && punit->client.occupied) {
@@ -1642,8 +1645,8 @@
       = game_unit_by_number(packet_unit->client.transported_by);
 
     /* Load unit only if transporter is known by the client. For full
-     * unit info the transporter should be known. See recursive sending
-     * of transporter information in send_unit_info_to_onlookers(). */
+     * unit info the transporter should be known. The server sends
+     * transporters first; see send_unit_info(). */
     if (ptrans && ptrans != unit_transport_get(punit)) {
       /* First, we have to unload the unit from its old transporter. */
       unit_transport_unload(punit);

Modified: branches/S2_5/server/unittools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/unittools.c?rev=28810&r1=28809&r2=28810&view=diff
==============================================================================
--- branches/S2_5/server/unittools.c    (original)
+++ branches/S2_5/server/unittools.c    Sun Apr 19 14:51:16 2015
@@ -2456,10 +2456,12 @@
 
   powner = unit_owner(punit);
   package_unit(punit, &info[0]);
+  /* For cargo and transporters of the same player, the client relies on
+   * receiving the transporter info first, so we send it first here. */
   i = 1;
   unit_transports_iterate(punit, ptrans) {
     fc_assert_action(i < ARRAY_SIZE(info), break);
-    package_unit(punit, &info[i++]);
+    package_unit(ptrans, &info[i++]);
   } unit_transports_iterate_end;
   info_num = i;
   package_short_unit(punit, &sinfo, UNIT_INFO_IDENTITY, 0, FALSE);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to