Codechange: use std::any_of instead of custom loop

This commit is contained in:
Rubidium 2024-04-09 17:09:23 +02:00 committed by rubidium42
parent 6cade18053
commit ff27b9e76a
1 changed files with 1 additions and 7 deletions

View File

@ -775,13 +775,7 @@ static void UpdateIndustryProduction(Industry *i);
static inline bool IsProductionAlterable(const Industry *i)
{
const IndustrySpec *is = GetIndustrySpec(i->type);
bool has_prod = false;
for (size_t j = 0; j < lengthof(is->production_rate); j++) {
if (is->production_rate[j] != 0) {
has_prod = true;
break;
}
}
bool has_prod = std::any_of(std::begin(is->production_rate), std::end(is->production_rate), [](auto rate) { return rate != 0; });
return ((_game_mode == GM_EDITOR || _cheats.setup_prod.value) &&
(has_prod || is->IsRawIndustry()) &&
!_networking);