diff --git a/src/economy.cpp b/src/economy.cpp index 628970b..93ae0f8 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1158,7 +1158,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) bool completely_emptied = true; bool anything_unloaded = false; bool anything_loaded = false; - bool full_load_amount = false; + bool full_load_amount = true; uint32 cargo_not_full = 0; uint32 cargo_full = 0; @@ -1280,7 +1280,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) count = cargo_left[v->cargo_type]; cargo_left[v->cargo_type] -= cap; } - if (count >= (uint)cap_left) full_load_amount = true; + if (count < (uint)cap_left) full_load_amount = false; if (v->cargo.Empty()) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO); @@ -1342,8 +1342,9 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left) unloading_time = gradual_loading_wait_time[v->type]; } - /* We loaded less cargo than possible and it's not full load, stop loading. */ - if (!anything_unloaded && !full_load_amount && !(v->current_order.GetLoadType() & OLFB_FULL_LOAD)) SetBit(u->vehicle_flags, VF_STOP_LOADING); + /* We loaded less cargo than possible and it's not full load and we're not supposed to wait any longer, stop loading. */ + if (!anything_unloaded && !full_load_amount && !(v->current_order.GetLoadType() & OLFB_FULL_LOAD) && + (u->current_order_time >= (uint32) max(u->current_order.wait_time - u->lateness_counter, 0))) SetBit(u->vehicle_flags, VF_STOP_LOADING); } else { bool finished_loading = true; if (v->current_order.GetLoadType() & OLFB_FULL_LOAD) {