From 38bf41149497aa0881606ea1b8c6e050ba0eee32 Mon Sep 17 00:00:00 2001 From: insunaa Date: Sun, 5 Jun 2022 13:07:06 +0200 Subject: [PATCH] Fix delayed respawnsave crash Closes https://github.com/cmangos/mangos-tbc/pull/542 --- src/game/Maps/Map.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 240276d74cc..8217f99f4ca 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -987,16 +987,15 @@ void Map::Remove(T* obj, bool remove) m_objRemoveList.insert(obj->GetObjectGuid()); - obj->ResetMap(); if (remove) - { // if option set then object already saved at this moment if (!sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY)) - obj->SaveRespawnTime(); + obj->SaveRespawnTime(); // requires map not being reset - // Note: In case resurrectable corpse and pet its removed from global lists in own destructor + obj->ResetMap(); + + if (remove) // Note: In case resurrectable corpse and pet its removed from global lists in own destructor delete obj; - } } void Map::PlayerRelocation(Player* player, float x, float y, float z, float orientation)