Author: pepeto
Date: Sat Jul 19 11:05:58 2014
New Revision: 25615

URL: http://svn.gna.org/viewcvs/freeciv?rev=25615&view=rev
Log:
Recursive transport:
* remove unrelated test from could_unit_load() ;
* re-establish the rule a transporter cannot carry a cargo unit which can
transport it.

Reported by Jacob Nevins (jtn@gna)

See gna bug #22050

Modified:
    trunk/common/unit.c

Modified: trunk/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=25615&r1=25614&r2=25615&view=diff
==============================================================================
--- trunk/common/unit.c (original)
+++ trunk/common/unit.c Sat Jul 19 11:05:58 2014
@@ -804,13 +804,6 @@
 
   /* Make sure this transporter can carry this type of unit. */
   if (!can_unit_transport(ptrans, pcargo)) {
-    return FALSE;
-  }
-
-  /* Transporter must be native to the tile it is on (or it itself is
-   * transported). */
-  if (!can_unit_exist_at_tile(ptrans, unit_tile(ptrans))
-      && !unit_transported(ptrans)) {
     return FALSE;
   }
 
@@ -2361,8 +2354,9 @@
   Returns whether 'pcargo' in 'ptrans' is a valid transport. Note that
   'pcargo' can already be (but doesn't need) loaded into 'ptrans'.
 
-  It may fail if the cargo has the same type of one of the transport
-  (recursively).
+  It may fail if one of the cargo unit has the same type of one of the
+  transporter unit or if one of the cargo unit can transport one of
+  the transporter (recursively).
 ****************************************************************************/
 bool unit_transport_check(const struct unit *pcargo,
                           const struct unit *ptrans)
@@ -2373,7 +2367,8 @@
   /* Check transporters. */
   for (plevel = ptrans; NULL != plevel;
        plevel = unit_transport_get(plevel)) {
-    if (unit_type(plevel) == cargo_utype) {
+    if (unit_type(plevel) == cargo_utype
+        || can_unit_type_transport(cargo_utype, unit_class(plevel))) {
       return FALSE;
     }
   }


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

Reply via email to