1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Rework remove floating to use EntityList (#13895)

This commit is contained in:
Duncan
2021-01-22 14:36:55 +00:00
committed by GitHub
parent bc20efb3df
commit 1a11456f36

View File

@@ -827,29 +827,24 @@ void litter_remove_at(const CoordsXYZ& litterPos)
uint16_t remove_floating_sprites() uint16_t remove_floating_sprites()
{ {
uint16_t removed = 0; uint16_t removed = 0;
for (uint16_t i = 0; i < MAX_SPRITES; i++) for (auto* balloon : EntityList<Balloon>(EntityListId::Misc))
{ {
auto* entity = GetEntity(i); sprite_remove(balloon);
if (entity->Is<Balloon>()) removed++;
}
for (auto* duck : EntityList<Duck>(EntityListId::Misc))
{
if (duck->IsFlying())
{ {
sprite_remove(entity); sprite_remove(duck);
removed++;
}
else if (entity->Is<Duck>())
{
auto* duck = entity->As<Duck>();
if (duck->IsFlying())
{
duck->Remove();
removed++;
}
}
else if (entity->Is<MoneyEffect>())
{
sprite_remove(entity);
removed++; removed++;
} }
} }
for (auto* money : EntityList<MoneyEffect>(EntityListId::Misc))
{
sprite_remove(money);
removed++;
}
return removed; return removed;
} }