(svn r18566) -Codechange: When both the union and intersection of refit masks of articulated vehicles are needed, they can be determined at once.

This commit is contained in:
frosch
2009-12-20 14:28:55 +00:00
parent e5ebae1085
commit 1e1fa9ff2e
3 changed files with 39 additions and 39 deletions

View File

@@ -170,13 +170,13 @@ static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, EngineID engine_ty
static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool part_of_chain)
{
CargoID cargo_type;
uint32 available_cargo_types, union_mask;
GetArticulatedRefitMasks(engine_type, true, &union_mask, &available_cargo_types);
if (GetUnionOfArticulatedRefitMasks(engine_type, true) == 0) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
if (union_mask == 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, 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.