mirror of https://github.com/OpenTTD/OpenTTD
(svn r20843) -Fix [FS#2534] (r20506): Make sure (gradual) loading is properly terminated for consists with multiple cargo types. Don't stop loading if the timetabled wait is not over yet. (Steve-N)
parent
faf5c48533
commit
12133ffb31
|
@ -1158,7 +1158,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
|
||||||
bool completely_emptied = true;
|
bool completely_emptied = true;
|
||||||
bool anything_unloaded = false;
|
bool anything_unloaded = false;
|
||||||
bool anything_loaded = false;
|
bool anything_loaded = false;
|
||||||
bool full_load_amount = false;
|
uint32 full_load_amount = 0;
|
||||||
uint32 cargo_not_full = 0;
|
uint32 cargo_not_full = 0;
|
||||||
uint32 cargo_full = 0;
|
uint32 cargo_full = 0;
|
||||||
|
|
||||||
|
@ -1280,7 +1280,13 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
|
||||||
count = cargo_left[v->cargo_type];
|
count = cargo_left[v->cargo_type];
|
||||||
cargo_left[v->cargo_type] -= cap;
|
cargo_left[v->cargo_type] -= cap;
|
||||||
}
|
}
|
||||||
if (count >= (uint)cap_left) full_load_amount = true;
|
|
||||||
|
/* Store whether the maximum possible load amount was loaded or not.*/
|
||||||
|
if (count >= (uint)cap_left) {
|
||||||
|
SetBit(full_load_amount, v->cargo_type);
|
||||||
|
} else {
|
||||||
|
ClrBit(full_load_amount, v->cargo_type);
|
||||||
|
}
|
||||||
|
|
||||||
if (v->cargo.Empty()) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
|
if (v->cargo.Empty()) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO);
|
||||||
|
|
||||||
|
@ -1342,8 +1348,12 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
|
||||||
|
|
||||||
unloading_time = gradual_loading_wait_time[v->type];
|
unloading_time = gradual_loading_wait_time[v->type];
|
||||||
}
|
}
|
||||||
/* We loaded less cargo than possible and it's not full load, stop loading. */
|
/* We loaded less cargo than possible for all cargo types and it's not full
|
||||||
if (!anything_unloaded && !full_load_amount && !(v->current_order.GetLoadType() & OLFB_FULL_LOAD)) SetBit(u->vehicle_flags, VF_STOP_LOADING);
|
* load and we're not supposed to wait any longer: stop loading. */
|
||||||
|
if (!anything_unloaded && full_load_amount == 0 && !(v->current_order.GetLoadType() & OLFB_FULL_LOAD) &&
|
||||||
|
(!_settings_game.order.timetabling || v->current_order_time >= (uint)max(v->current_order.wait_time - v->lateness_counter, 0))) {
|
||||||
|
SetBit(v->vehicle_flags, VF_STOP_LOADING);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bool finished_loading = true;
|
bool finished_loading = true;
|
||||||
if (v->current_order.GetLoadType() & OLFB_FULL_LOAD) {
|
if (v->current_order.GetLoadType() & OLFB_FULL_LOAD) {
|
||||||
|
|
Loading…
Reference in New Issue