summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2018-05-21 22:08:39 +0100
committerGitHub <noreply@github.com>2018-05-21 22:08:39 +0100
commit4cebebcf683b079ff010e70b0a0a78c12734933e (patch)
tree4f140272bd8c1efba4916a642b85a22f153cb7b4 /src/engine.cpp
parent42b43c998314a3fcd89aa59ad7834104dd80b053 (diff)
downloadopenttd-4cebebcf683b079ff010e70b0a0a78c12734933e.tar.xz
Change: Add CargoTypes type for cargo masks. (#6790)
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index b0af3bc4d..ac2e8df0e 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -752,7 +752,7 @@ static CompanyID GetPreviewCompany(Engine *e)
CompanyID best_company = INVALID_COMPANY;
/* For trains the cargomask has no useful meaning, since you can attach other wagons */
- uint32 cargomask = e->type != VEH_TRAIN ? GetUnionOfArticulatedRefitMasks(e->index, true) : (uint32)-1;
+ CargoTypes cargomask = e->type != VEH_TRAIN ? GetUnionOfArticulatedRefitMasks(e->index, true) : ALL_CARGOTYPES;
int32 best_hist = -1;
const Company *c;
@@ -1117,7 +1117,9 @@ bool IsEngineRefittable(EngineID engine)
/* Is there any cargo except the default cargo? */
CargoID default_cargo = e->GetDefaultCargoType();
- return default_cargo != CT_INVALID && ei->refit_mask != 1U << default_cargo;
+ CargoTypes default_cargo_mask = 0;
+ SetBit(default_cargo_mask, default_cargo);
+ return default_cargo != CT_INVALID && ei->refit_mask != default_cargo_mask;
}
/**