aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/Maps/Map.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 001f22815b5..418e06ed1c3 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -824,9 +824,17 @@ void Map::MoveAllCreaturesInMoveList()
}
else
{
+ //AddObjectToRemoveList(Pet*) should only be called in Pet::Remove
+ //This may happen when a player just logs in and a pet moves to a nearby unloaded cell
+ //To avoid this, we can load nearby cells when player log in
+ //But this check is always needed to ensure safety
+ if (c->isPet())
+ {
+ ((Pet*)c)->Remove(PET_SAVE_NOT_IN_SLOT, true);
+ }
// if creature can't be move in new cell/grid (not loaded) move it to repawn cell/grid
// creature coordinates will be updated and notifiers send
- if (!CreatureRespawnRelocation(c))
+ else if (!CreatureRespawnRelocation(c))
{
// ... or unload (if respawn grid also not loaded)
#ifdef TRINITY_DEBUG