1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-31 02:35:46 +01:00

Remove staff limit and increase patrol area to whole map

This commit is contained in:
Ted John
2021-05-11 22:38:03 +01:00
parent 435e012286
commit 34f9d5ae8e
15 changed files with 196 additions and 187 deletions

View File

@@ -223,6 +223,24 @@ const std::list<uint16_t>& GetEntityList(const EntityType id)
return gEntityLists[EnumValue(id)];
}
/**
* Frees any dynamically attached memory to the entity, such as peep name.
*/
static void FreeEntity(SpriteBase& entity)
{
auto peep = entity.As<Peep>();
if (peep != nullptr)
{
peep->SetName({});
auto staff = peep->As<Staff>();
if (staff != nullptr)
{
staff->ClearPatrolArea();
}
}
}
/**
*
* rct2: 0x0069EB13
@@ -230,6 +248,16 @@ const std::list<uint16_t>& GetEntityList(const EntityType id)
void reset_sprite_list()
{
gSavedAge = 0;
for (int32_t i = 0; i < MAX_ENTITIES; ++i)
{
auto* entity = GetEntity(i);
if (entity != nullptr)
{
FreeEntity(*entity);
}
}
std::memset(static_cast<void*>(_spriteList), 0, sizeof(_spriteList));
for (int32_t i = 0; i < MAX_ENTITIES; ++i)
{
@@ -687,11 +715,7 @@ void sprite_set_coordinates(const CoordsXYZ& spritePos, SpriteBase* sprite)
*/
void sprite_remove(SpriteBase* sprite)
{
auto peep = sprite->As<Peep>();
if (peep != nullptr)
{
peep->SetName({});
}
FreeEntity(*sprite);
EntityTweener::Get().RemoveEntity(sprite);
RemoveFromEntityList(sprite); // remove from existing list