Avoid auto-refitting to cargo which is marked no-load in per-cargo type order

This commit is contained in:
Jonathan G Rennison 2018-03-27 02:04:22 +01:00
parent c779915ccb
commit 7c620edb52

View File

@ -1543,11 +1543,13 @@ static void HandleStationRefit(Vehicle *v, CargoArray &consist_capleft, Station
IterateVehicleParts(v_start, PrepareRefitAction(consist_capleft, refit_mask));
bool is_auto_refit = new_cid == CT_AUTO_REFIT;
bool check_order = (v->First()->current_order.GetLoadType() == OLFB_CARGO_TYPE_LOAD);
if (is_auto_refit) {
/* Get a refittable cargo type with waiting cargo for next_station or INVALID_STATION. */
CargoID cid;
new_cid = v_start->cargo_type;
FOR_EACH_SET_CARGO_ID(cid, refit_mask) {
if (check_order && v->First()->current_order.GetCargoLoadType(cid) == OLFB_NO_LOAD) continue;
if (st->goods[cid].cargo.HasCargoFor(next_station.Get(cid))) {
/* Try to find out if auto-refitting would succeed. In case the refit is allowed,
* the returned refit capacity will be greater than zero. */