From 082404e443c0560d78a221cfc5477e7d7c71e575 Mon Sep 17 00:00:00 2001 From: TechGeekNZ Date: Wed, 27 May 2020 13:32:11 +1200 Subject: [PATCH] Fix: Vehicle leaves station without loading if there is a per-cargo "no load" order for the currently fitted cargo. --- src/economy.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index 9c82d3406c..959a78b08e 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1754,8 +1754,9 @@ static void LoadUnloadVehicle(Vehicle *front) continue; } - /* Do not pick up goods when we have no-load set or loading is stopped. */ - if (GetLoadType(v) & OLFB_NO_LOAD || HasBit(front->vehicle_flags, VF_STOP_LOADING)) continue; + /* Do not pick up goods when we have no-load set or loading is stopped. + * Per-cargo no-load orders can only be checked after attempting to refit. */ + if (front->current_order.GetLoadType() & OLFB_NO_LOAD || HasBit(front->vehicle_flags, VF_STOP_LOADING)) continue; /* This order has a refit, if this is the first vehicle part carrying cargo and the whole vehicle is empty, try refitting. */ if (front->current_order.IsRefit() && artic_part == 1) { @@ -1763,6 +1764,9 @@ static void LoadUnloadVehicle(Vehicle *front) ge = &st->goods[v->cargo_type]; } + /* Do not pick up goods when we have no-load set. */ + if (GetLoadType(v) & OLFB_NO_LOAD) continue; + /* As we're loading here the following link can carry the full capacity of the vehicle. */ v->refit_cap = v->cargo_cap;