Skip to content

Commit

Permalink
StringId: Fix string id objects not being cleared on despawn
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Nov 21, 2023
1 parent fd90b98 commit 0188d4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/game/Entities/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2037,12 +2037,15 @@ void WorldObject::AddToWorld()

void WorldObject::RemoveFromWorld()
{
if (m_isOnEventNotified)
m_currMap->RemoveFromOnEventNotified(this);
if (IsInWorld())
{
if (m_isOnEventNotified)
m_currMap->RemoveFromOnEventNotified(this);

if (!m_stringIds.empty())
for (uint32 stringId : m_stringIds)
m_currMap->RemoveStringIdObject(stringId, this);
if (!m_stringIds.empty())
for (uint32 stringId : m_stringIds)
m_currMap->RemoveStringIdObject(stringId, this);
}

Object::RemoveFromWorld();
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/Entities/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9778,7 +9778,7 @@ void Unit::RemoveFromWorld()
m_FollowingRefManager.clearReferences();
}

Object::RemoveFromWorld();
WorldObject::RemoveFromWorld();
}

void Unit::CleanupsBeforeDelete()
Expand Down

0 comments on commit 0188d4c

Please sign in to comment.