diff options
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r-- | src/autoreplace_cmd.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index 2c3f973f8..ededb4cd6 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -33,10 +33,10 @@ extern void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index); * @param type the type of the engines * @return true if they can both carry the same type of cargo (or at least one of them got no capacity at all) */ -static bool EnginesGotCargoInCommon(EngineID engine_a, EngineID engine_b, VehicleType type) +static bool EnginesHaveCargoInCommon(EngineID engine_a, EngineID engine_b) { - uint32 available_cargos_a = GetUnionOfArticulatedRefitMasks(engine_a, type, true); - uint32 available_cargos_b = GetUnionOfArticulatedRefitMasks(engine_b, type, true); + uint32 available_cargos_a = GetUnionOfArticulatedRefitMasks(engine_a, true); + uint32 available_cargos_b = GetUnionOfArticulatedRefitMasks(engine_b, true); return (available_cargos_a == 0 || available_cargos_b == 0 || (available_cargos_a & available_cargos_b) != 0); } @@ -87,7 +87,7 @@ bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company) } /* the engines needs to be able to carry the same cargo */ - return EnginesGotCargoInCommon(from, to, type); + return EnginesHaveCargoInCommon(from, to); } /** Transfer cargo from a single (articulated )old vehicle to the new vehicle chain @@ -138,8 +138,8 @@ static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, EngineID engine_ty const Order *o; const Vehicle *u; - uint32 union_refit_mask_a = GetUnionOfArticulatedRefitMasks(v->engine_type, v->type, false); - uint32 union_refit_mask_b = GetUnionOfArticulatedRefitMasks(engine_type, v->type, false); + uint32 union_refit_mask_a = GetUnionOfArticulatedRefitMasks(v->engine_type, false); + uint32 union_refit_mask_b = GetUnionOfArticulatedRefitMasks(engine_type, false); if (v->type == VEH_TRAIN) { u = v->First(); @@ -171,11 +171,11 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool { CargoID cargo_type; - if (GetUnionOfArticulatedRefitMasks(engine_type, v->type, true) == 0) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity + if (GetUnionOfArticulatedRefitMasks(engine_type, true) == 0) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity if (IsArticulatedVehicleCarryingDifferentCargos(v, &cargo_type)) return CT_INVALID; // We cannot refit to mixed cargos in an automated way - uint32 available_cargo_types = GetIntersectionOfArticulatedRefitMasks(engine_type, v->type, true); + uint32 available_cargo_types = GetIntersectionOfArticulatedRefitMasks(engine_type, true); if (cargo_type == CT_INVALID) { if (v->type != VEH_TRAIN) return CT_NO_REFIT; // If the vehicle does not carry anything at all, every replacement is fine. @@ -190,7 +190,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool /* Now we found a cargo type being carried on the train and we will see if it is possible to carry to this one */ if (HasBit(available_cargo_types, v->cargo_type)) { /* Do we have to refit the vehicle, or is it already carrying the right cargo? */ - CargoArray default_capacity = GetCapacityOfArticulatedParts(engine_type, v->type); + CargoArray default_capacity = GetCapacityOfArticulatedParts(engine_type); for (CargoID cid = 0; cid < NUM_CARGO; cid++) { if (cid != v->cargo_type && default_capacity[cid] > 0) return v->cargo_type; } @@ -206,7 +206,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool if (part_of_chain && !VerifyAutoreplaceRefitForOrders(v, engine_type)) return CT_INVALID; // Some refit orders lose their effect /* Do we have to refit the vehicle, or is it already carrying the right cargo? */ - CargoArray default_capacity = GetCapacityOfArticulatedParts(engine_type, v->type); + CargoArray default_capacity = GetCapacityOfArticulatedParts(engine_type); for (CargoID cid = 0; cid < NUM_CARGO; cid++) { if (cid != cargo_type && default_capacity[cid] > 0) return cargo_type; } |