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

@@ -2617,8 +2617,8 @@ struct IndustryCargoesWindow : public Window {
const IndustrySpec *indsp = GetIndustrySpec(it);
if (!indsp->enabled) continue;
this->ind_textsize = maxdim(this->ind_textsize, GetStringBoundingBox(indsp->name));
CargoesField::max_cargoes = std::max<uint>(CargoesField::max_cargoes, std::count_if(std::begin(indsp->accepts_cargo), std::end(indsp->accepts_cargo), IsValidCargoID));
CargoesField::max_cargoes = std::max<uint>(CargoesField::max_cargoes, std::count_if(std::begin(indsp->produced_cargo), std::end(indsp->produced_cargo), IsValidCargoID));
CargoesField::max_cargoes = std::max<uint>(CargoesField::max_cargoes, std::ranges::count_if(indsp->accepts_cargo, IsValidCargoID));
CargoesField::max_cargoes = std::max<uint>(CargoesField::max_cargoes, std::ranges::count_if(indsp->produced_cargo, IsValidCargoID));
}
d.width = std::max(d.width, this->ind_textsize.width);
d.height = this->ind_textsize.height;