<URL: http://bugs.freeciv.org/Ticket/Display.html?id=34551 >
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. - ML
diff -Nurd -X.diff_ignore freeciv/ai/aiferry.c freeciv/ai/aiferry.c --- freeciv/ai/aiferry.c 2006-07-17 23:56:47.000000000 +0300 +++ freeciv/ai/aiferry.c 2007-01-25 20:29:14.000000000 +0200 @@ -43,7 +43,10 @@ /* * 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 heading to boat, but boat + * might take another passenger */ + /* * The below is used only by passengers in ai.ferryboat field */ @@ -888,11 +891,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 +954,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