Codechange: Use EnumBitSet for CargoClasses. (#13491)

This commit is contained in:
Peter Nelson
2025-02-08 08:46:38 +00:00
committed by GitHub
parent 04d53ed6f5
commit d61b376998
18 changed files with 157 additions and 160 deletions
+3 -3
View File
@@ -446,7 +446,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
/* Skip empty engines */
if (!u->GetEngine()->CanCarryCargo()) continue;
cargo_classes |= CargoSpec::Get(u->cargo_type)->classes;
cargo_classes |= CargoSpec::Get(u->cargo_type)->classes.base();
common_cargoes[u->cargo_type]++;
}
@@ -554,7 +554,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
* is object->ro.grffile.
* In case of CBID_TRAIN_ALLOW_WAGON_ATTACH this is not the same as v->GetGRF().
*/
return (cs->classes << 16) | (cs->weight << 8) | object->ro.grffile->cargo_map[v->cargo_type];
return (cs->classes.base() << 16) | (cs->weight << 8) | object->ro.grffile->cargo_map[v->cargo_type];
}
case 0x48: return v->GetEngine()->flags.base(); // Vehicle Type Info
@@ -952,7 +952,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec
CargoType cargo_type = e->GetDefaultCargoType();
if (IsValidCargoType(cargo_type)) {
const CargoSpec *cs = CargoSpec::Get(cargo_type);
return (cs->classes << 16) | (cs->weight << 8) | this->ro.grffile->cargo_map[cargo_type];
return (cs->classes.base() << 16) | (cs->weight << 8) | this->ro.grffile->cargo_map[cargo_type];
} else {
return 0x000000FF;
}