1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Use entity list size rather than distance (#14343)

After the refactors with the entity lists we no longer require to walk the whole entity list to get the number of entries.
This commit is contained in:
Duncan
2021-03-17 08:55:10 +00:00
committed by GitHub
parent 129ef12d6d
commit 4d152d97d2
2 changed files with 3 additions and 8 deletions

View File

@@ -263,10 +263,8 @@ static bool award_is_deserved_best_staff(int32_t activeAwardTypes)
if (activeAwardTypes & EnumToFlag(ParkAward::MostUntidy))
return false;
auto staff = EntityList<Staff>();
auto staffCount = std::distance(staff.begin(), staff.end());
auto guests = EntityList<Guest>();
auto peepCount = std::distance(guests.begin(), guests.end());
auto staffCount = GetEntityListCount(EntityType::Staff);
auto peepCount = GetEntityListCount(EntityType::Guest);
return ((staffCount != 0) && staffCount >= 20 && staffCount >= peepCount / 32);
}

View File

@@ -384,10 +384,7 @@ Peep* try_get_guest(uint16_t spriteIndex)
int32_t peep_get_staff_count()
{
auto list = EntityList<Staff>();
auto count = std::distance(list.begin(), list.end());
return count;
return GetEntityListCount(EntityType::Staff);
}
/**