1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Replace loop with count_if

This commit is contained in:
ζeh Matt
2021-10-14 16:32:05 +03:00
parent f701d2ceb5
commit e1fb987c12

View File

@@ -463,17 +463,11 @@ int32_t Park::CalculateParkRating() const
// Litter
{
int32_t litterCount = 0;
for (auto* litter : EntityList<Litter>())
{
if (litter->GetAge() < 7680)
{
// Ignore recently dropped litter.
continue;
}
// Counts the amount of litter whose age is min. 7680 ticks (5~ min) old.
const auto litterList = EntityList<Litter>();
const auto litterCount = std::count_if(
litterList.begin(), litterList.end(), [](auto* litter) { return litter->GetAge() >= 7680; });
litterCount++;
}
result -= 600 - (4 * (150 - std::min<int32_t>(150, litterCount)));
}