From 0f183e9ad2af9c344fe60d192e1d70b9c030cd1e Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 12 Sep 2021 18:29:37 +0200 Subject: [PATCH] Make FreeEntity take a reference --- src/openrct2/world/Sprite.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openrct2/world/Sprite.cpp b/src/openrct2/world/Sprite.cpp index 7faafd75c5..34571a5bce 100644 --- a/src/openrct2/world/Sprite.cpp +++ b/src/openrct2/world/Sprite.cpp @@ -44,7 +44,7 @@ constexpr const uint32_t SPATIAL_INDEX_LOCATION_NULL = SPATIAL_INDEX_SIZE - 1; static std::array, SPATIAL_INDEX_SIZE> gSpriteSpatialIndex; -static void FreeEntity(EntityBase* entity); +static void FreeEntity(EntityBase& entity); constexpr size_t GetSpatialIndexOffset(int32_t x, int32_t y) { @@ -238,7 +238,7 @@ void reset_sprite_list() { continue; } - FreeEntity(spr); + FreeEntity(*spr); spr->Type = EntityType::Null; spr->sprite_index = i; @@ -545,10 +545,10 @@ void sprite_set_coordinates(const CoordsXYZ& spritePos, EntityBase* sprite) /** * Frees any dynamically attached memory to the entity, such as peep name. */ -static void FreeEntity(EntityBase* entity) +static void FreeEntity(EntityBase& entity) { - auto* guest = entity->As(); - auto* staff = entity->As(); + auto* guest = entity.As(); + auto* staff = entity.As(); if (staff != nullptr) { staff->SetName({}); @@ -567,7 +567,7 @@ static void FreeEntity(EntityBase* entity) */ void sprite_remove(EntityBase* sprite) { - FreeEntity(sprite); + FreeEntity(*sprite); EntityTweener::Get().RemoveEntity(sprite); RemoveFromEntityList(sprite); // remove from existing list