Remove various uses of lengthof on std::array

This commit is contained in:
Jonathan G Rennison
2024-04-08 19:55:58 +01:00
parent 919830db7a
commit 28e74005d0
15 changed files with 77 additions and 77 deletions

View File

@@ -166,7 +166,7 @@ static bool CMSAMine(TileIndex tile)
/* No extractive industry */
if ((GetIndustrySpec(ind->type)->life_type & INDUSTRYLIFE_EXTRACTIVE) == 0) return false;
for (uint i = 0; i < lengthof(ind->produced_cargo); i++) {
for (uint i = 0; i < std::size(ind->produced_cargo); i++) {
/* The industry extracts something non-liquid, i.e. no oil or plastic, so it is a mine.
* Also the production of passengers and mail is ignored. */
if (ind->produced_cargo[i] != INVALID_CARGO &&
@@ -639,7 +639,7 @@ CargoArray GetProductionAroundTiles(TileIndex north_tile, int w, int h, int rad)
/* Skip industry with neutral station */
if (i->neutral_station != nullptr && !_settings_game.station.serve_neutral_industries) continue;
for (uint j = 0; j < lengthof(i->produced_cargo); j++) {
for (uint j = 0; j < std::size(i->produced_cargo); j++) {
CargoID cargo = i->produced_cargo[j];
if (cargo != INVALID_CARGO) produced[cargo]++;
}