mirror of https://github.com/OpenTTD/OpenTTD
(svn r9789) -Fix (r9770): vehicles didn't get unloaded when 'full load' was specified and the vehicle was already full when it entered.
parent
79637ef7b8
commit
438d55d576
|
@ -704,7 +704,6 @@ void CallVehicleTicks()
|
||||||
static bool CanFillVehicle_FullLoadAny(Vehicle *v)
|
static bool CanFillVehicle_FullLoadAny(Vehicle *v)
|
||||||
{
|
{
|
||||||
uint32 full = 0, not_full = 0;
|
uint32 full = 0, not_full = 0;
|
||||||
bool keep_loading = false;
|
|
||||||
const GoodsEntry *ge = GetStation(v->last_station_visited)->goods;
|
const GoodsEntry *ge = GetStation(v->last_station_visited)->goods;
|
||||||
|
|
||||||
/* special handling of aircraft */
|
/* special handling of aircraft */
|
||||||
|
@ -725,13 +724,13 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v)
|
||||||
if (v->cargo_cap != 0) {
|
if (v->cargo_cap != 0) {
|
||||||
uint32 mask = 1 << v->cargo_type;
|
uint32 mask = 1 << v->cargo_type;
|
||||||
|
|
||||||
if (v->cargo_cap == v->cargo_count) {
|
if (!HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) && v->cargo_cap == v->cargo_count) {
|
||||||
full |= mask;
|
full |= mask;
|
||||||
} else if (GB(ge[v->cargo_type].waiting_acceptance, 0, 12) > 0 ||
|
} else if (GB(ge[v->cargo_type].waiting_acceptance, 0, 12) > 0 ||
|
||||||
(HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) && (ge[v->cargo_type].waiting_acceptance & 0x8000))) {
|
(HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) && (ge[v->cargo_type].waiting_acceptance & 0x8000))) {
|
||||||
/* If there is any cargo waiting, or this vehicle is still unloading
|
/* If there is any cargo waiting, or this vehicle is still unloading
|
||||||
* and the station accepts the cargo, don't leave the station. */
|
* and the station accepts the cargo, don't leave the station. */
|
||||||
keep_loading = true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
not_full |= mask;
|
not_full |= mask;
|
||||||
}
|
}
|
||||||
|
@ -739,7 +738,7 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v)
|
||||||
} while ((v = v->next) != NULL);
|
} while ((v = v->next) != NULL);
|
||||||
|
|
||||||
/* continue loading if there is a non full cargo type and no cargo type that is full */
|
/* continue loading if there is a non full cargo type and no cargo type that is full */
|
||||||
return keep_loading || (not_full && (full & ~not_full) == 0);
|
return not_full && (full & ~not_full) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue