Author: pepeto
Date: Sat Jul 19 11:06:03 2014
New Revision: 25616

URL: http://svn.gna.org/viewcvs/freeciv?rev=25616&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:
    branches/S2_5/common/unit.c

Modified: branches/S2_5/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.c?rev=25616&r1=25615&r2=25616&view=diff
==============================================================================
--- branches/S2_5/common/unit.c (original)
+++ branches/S2_5/common/unit.c Sat Jul 19 11:06:03 2014
@@ -814,13 +814,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;
   }
 
@@ -2400,8 +2393,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)
@@ -2412,7 +2406,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