From a74b8bfc14cf45b51dc32c093c8cc61ec681da81 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Tue, 9 Apr 2024 17:09:23 +0200 Subject: [PATCH] Codechange: use std::any_of instead of custom loop --- src/industry_gui.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index f682f0cc13..64a3a1bf62 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -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);