summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-12-21 20:56:27 +0000
committerDarkvater <darkvater@openttd.org>2006-12-21 20:56:27 +0000
commitbb9c6c5fc5d3023344708a46da564d5b8e760b77 (patch)
tree2ca50e0622dd6ef0512f3e2641f665cd6b371247
parentd88e549d9f140507eb5786d68878b4983bd67493 (diff)
downloadopenttd-bb9c6c5fc5d3023344708a46da564d5b8e760b77.tar.xz
(svn r7535) -Fix (r7326): Always unload cargo if the station accepts it, and always load cargo
if it's available with full load any (Maedhros)
-rw-r--r--vehicle.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/vehicle.c b/vehicle.c
index 9ef5918a0..28551f28d 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -687,6 +687,8 @@ void CallVehicleTicks(void)
static bool CanFillVehicle_FullLoadAny(Vehicle *v)
{
uint32 full = 0, not_full = 0;
+ bool keep_loading = false;
+ const GoodsEntry *ge = GetStation(v->last_station_visited)->goods;
//special handling of aircraft
@@ -708,6 +710,11 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v)
if (v->cargo_cap == v->cargo_count) {
full |= mask;
+ } else if (GB(ge[v->cargo_type].waiting_acceptance, 0, 12) > 0 ||
+ (HASBIT(v->load_status, LS_CARGO_UNLOADING) && (ge[v->cargo_type].waiting_acceptance & 0x8000))) {
+ /* If there is any cargo waiting, or this vehicle is still unloading
+ * and the station accepts the cargo, don't leave the station. */
+ keep_loading = true;
} else {
not_full |= mask;
}
@@ -715,7 +722,7 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v)
} while ((v = v->next) != NULL);
// continue loading if there is a non full cargo type and no cargo type that is full
- return not_full && (full & ~not_full) == 0;
+ return keep_loading || (not_full && (full & ~not_full) == 0);
}
bool CanFillVehicle(Vehicle *v)