summaryrefslogtreecommitdiff
path: root/src/autoreplace_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-12-20 14:28:55 +0000
committerfrosch <frosch@openttd.org>2009-12-20 14:28:55 +0000
commit1e1fa9ff2eee6f194e2b3172f1cf0439113f50a6 (patch)
tree11b2f4bcb802a0326aae35068196a1ba1d4da6d8 /src/autoreplace_cmd.cpp
parente5ebae1085f40e25d9e939c5bd3ed29c2fd513c1 (diff)
downloadopenttd-1e1fa9ff2eee6f194e2b3172f1cf0439113f50a6.tar.xz
(svn r18566) -Codechange: When both the union and intersection of refit masks of articulated vehicles are needed, they can be determined at once.
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r--src/autoreplace_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index bf1104d34..0e7507cf6 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -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.