Codechange: use EnumBitSet for CargoTypes

This commit is contained in:
Peter Nelson
2025-03-26 18:48:53 +00:00
committed by Peter Nelson
parent 962a550d1b
commit c45aa3c9b6
55 changed files with 278 additions and 265 deletions
+3 -5
View File
@@ -932,7 +932,7 @@ static CompanyID GetPreviewCompany(Engine *e)
/* Check whether the company uses similar vehicles */
for (const Vehicle *v : Vehicle::Iterate()) {
if (v->owner != c->index || v->type != e->type) continue;
if (!v->GetEngine()->CanCarryCargo() || !HasBit(cargomask, v->cargo_type)) continue;
if (!v->GetEngine()->CanCarryCargo() || !cargomask.Test(v->cargo_type)) continue;
best_hist = c->old_economy[0].performance_history;
best_company = c->index;
@@ -1300,7 +1300,7 @@ bool IsEngineRefittable(EngineID engine)
if (!e->CanCarryCargo()) return false;
const EngineInfo *ei = &e->info;
if (ei->refit_mask == 0) return false;
if (ei->refit_mask.None()) return false;
/* Are there suffixes?
* Note: This does not mean the suffixes are actually available for every consist at any time. */
@@ -1308,9 +1308,7 @@ bool IsEngineRefittable(EngineID engine)
/* Is there any cargo except the default cargo? */
CargoType default_cargo = e->GetDefaultCargoType();
CargoTypes default_cargo_mask = 0;
SetBit(default_cargo_mask, default_cargo);
return IsValidCargoType(default_cargo) && ei->refit_mask != default_cargo_mask;
return IsValidCargoType(default_cargo) && ei->refit_mask != default_cargo;
}
/**