mirror of https://github.com/OpenTTD/OpenTTD
Codechange: use std::any_of instead of custom loop
parent
6cade18053
commit
ff27b9e76a
|
@ -775,13 +775,7 @@ static void UpdateIndustryProduction(Industry *i);
|
||||||
static inline bool IsProductionAlterable(const Industry *i)
|
static inline bool IsProductionAlterable(const Industry *i)
|
||||||
{
|
{
|
||||||
const IndustrySpec *is = GetIndustrySpec(i->type);
|
const IndustrySpec *is = GetIndustrySpec(i->type);
|
||||||
bool has_prod = false;
|
bool has_prod = std::any_of(std::begin(is->production_rate), std::end(is->production_rate), [](auto rate) { return rate != 0; });
|
||||||
for (size_t j = 0; j < lengthof(is->production_rate); j++) {
|
|
||||||
if (is->production_rate[j] != 0) {
|
|
||||||
has_prod = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ((_game_mode == GM_EDITOR || _cheats.setup_prod.value) &&
|
return ((_game_mode == GM_EDITOR || _cheats.setup_prod.value) &&
|
||||||
(has_prod || is->IsRawIndustry()) &&
|
(has_prod || is->IsRawIndustry()) &&
|
||||||
!_networking);
|
!_networking);
|
||||||
|
|
Loading…
Reference in New Issue