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

On 1/25/07, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
>
>  It took me a while to understand why ferry.ai.passenger sometimes get
> value 0 instead of FERRY_AVAILABLE. Attached patch makes that a bit
> clearer.

 Rewritten comment now I understand a bit better what there happens.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aiferry.c freeciv/ai/aiferry.c
--- freeciv/ai/aiferry.c	2007-01-27 00:09:15.000000000 +0200
+++ freeciv/ai/aiferry.c	2007-01-28 00:24:58.000000000 +0200
@@ -43,7 +43,11 @@
 /* 
  * This one is used only by ferryboats in ai.passenger field 
  */
-#define FERRY_AVAILABLE   -1      /* Boat is looking for a passenger */
+#define FERRY_AVAILABLE    -1     /* Boat is looking for a passenger */
+#define FERRY_ABANDON_BOSS  0     /* Passenger is assigned for boat, but boat
+                                   * might take another passenger. Probably
+                                   * passenger already left the boat*/
+
 /* 
  * The below is used only by passengers in ai.ferryboat field 
  */ 
@@ -888,11 +892,12 @@
 	UNIT_LOG(LOGLEVEL_FERRY, punit, 
 		 "recorded passenger[%d] is not on board, checking for others",
 		 punit->ai.passenger);
-	punit->ai.passenger = 0;
+	punit->ai.passenger = FERRY_ABANDON_BOSS;
       }
     }
 
-    if (punit->ai.passenger <= 0) {
+    if (punit->ai.passenger == FERRY_AVAILABLE
+        || punit->ai.passenger == FERRY_ABANDON_BOSS) {
       struct unit *candidate = NULL;
     
       /* Try to select passanger-in-charge from among our passengers */
@@ -950,7 +955,7 @@
 	} else if (get_transporter_occupancy(punit) != 0) {
 	  /* The boss isn't on the ferry, and we have other passengers?
 	   * Forget about him. */
-	  punit->ai.passenger = 0;
+	  punit->ai.passenger = FERRY_ABANDON_BOSS;
 	}
       }
     } else {
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to