Codechange: Use EnumBitSet for StationFacility.

This commit is contained in:
Peter Nelson
2025-02-12 19:42:26 +00:00
committed by Peter Nelson
parent 8d38308ebb
commit 75387b9e2b
39 changed files with 157 additions and 167 deletions

View File

@@ -118,7 +118,7 @@ static Money CalculateCompanyAssetValue(const Company *c)
uint num = 0;
for (const Station *st : Station::Iterate()) {
if (st->owner == owner) num += CountBits((uint8_t)st->facilities);
if (st->owner == owner) num += CountBits(st->facilities.base());
}
Money value = num * _price[PR_STATION_VALUE] * 25;
@@ -239,7 +239,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
uint num = 0;
for (const Station *st : Station::Iterate()) {
/* Only count stations that are actually serviced */
if (st->owner == owner && (st->time_since_load <= 20 || st->time_since_unload <= 20)) num += CountBits((uint8_t)st->facilities);
if (st->owner == owner && (st->time_since_load <= 20 || st->time_since_unload <= 20)) num += CountBits(st->facilities.base());
}
_score_part[owner][SCORE_STATIONS] = num;
}