Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] (PR#14043) Air-loading land-transporters traps and crashes
Home

[Freeciv-Dev] (PR#14043) Air-loading land-transporters traps and crashes

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: lo_oris@xxxxxxxx
Subject: [Freeciv-Dev] (PR#14043) Air-loading land-transporters traps and crashes
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Sep 2005 20:24:20 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14043 >

This patch should fix it (probably for 2.0 also).

Actually it looks like in the current code recursive transporting is
explicitly allowed.  However all the side effects of this aren't dealt
with properly - the crash you got probably happened because the
second-level cargo wasn't brought along when the top-level transporter
moved.

-jason

Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.250
diff -p -u -r1.250 unit.c
--- common/unit.c       22 Aug 2005 21:15:48 -0000      1.250
+++ common/unit.c       21 Sep 2005 03:22:57 -0000
@@ -583,6 +583,11 @@ bool can_unit_load(const struct unit *pc
     return FALSE;
   }
 
+  /* Recursive transporting is not allowed (for now). */
+  if (get_transporter_occupancy(pcargo) > 0) {
+    return FALSE;
+  }
+
   /* Make sure this transporter can carry this type of unit. */
   if(!can_unit_transport(ptrans, pcargo)) {
     return FALSE;
@@ -614,7 +619,8 @@ bool can_unit_unload(const struct unit *
   }
 
   /* Only top-level transporters may be unloaded.  However the unit being
-   * unloaded may be transporting other units. */
+   * unloaded may be transporting other units (well, at least it's allowed
+   * here: elsewhere this may be disallowed). */
   if (ptrans->transported_by != -1) {
     return FALSE;
   }

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