Codechange: Use std::ranges::count(_if).

This commit is contained in:
2024-11-10 10:53:52 +00:00
committed by Peter Nelson
parent 3be0166801
commit 876d53282e
7 changed files with 10 additions and 10 deletions

View File

@@ -387,7 +387,7 @@ bool FindSubsidyIndustryCargoRoute()
CargoID cid;
/* Randomize cargo type */
int num_cargos = std::count_if(std::begin(src_ind->produced), std::end(src_ind->produced), [](const auto &p) { return IsValidCargoID(p.cargo); });
int num_cargos = std::ranges::count_if(src_ind->produced, [](const auto &p) { return IsValidCargoID(p.cargo); });
if (num_cargos == 0) return false; // industry produces nothing
int cargo_num = RandomRange(num_cargos) + 1;