aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
authormegamage <none@none.none>2011-09-13 11:54:55 -0400
committermegamage <none@none.none>2011-09-13 11:54:55 -0400
commit76488854d8e59e66ae2e7389d8ec72d014ff4eb4 (patch)
treea38eb0a6a059ab876b6a433eeb017225845df67d /src/server/game/Maps/Map.cpp
parent937d26e0fe801ca6fe03c8304ca764e7ae121ef0 (diff)
A more conservative way to fix crash #2892.
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rwxr-xr-xsrc/server/game/Maps/Map.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 418e06ed1c3..3bba445b99e 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -824,23 +824,24 @@ 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
- else if (!CreatureRespawnRelocation(c))
+ if (!CreatureRespawnRelocation(c))
{
// ... or unload (if respawn grid also not loaded)
#ifdef TRINITY_DEBUG
sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", c->GetGUIDLow(), c->GetEntry());
#endif
- AddObjectToRemoveList(c);
+ //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
+ //TODO: pets will disappear if this is outside CreatureRespawnRelocation
+ //need to check why pet is frequently relocated to an unloaded cell
+ if (c->isPet())
+ ((Pet*)c)->Remove(PET_SAVE_NOT_IN_SLOT, true);
+ else
+ AddObjectToRemoveList(c);
}
}
@@ -933,8 +934,8 @@ bool Map::CreatureRespawnRelocation(Creature *c)
c->UpdateObjectVisibility(false);
return true;
}
- else
- return false;
+
+ return false;
}
bool Map::UnloadGrid(const uint32 x, const uint32 y, bool unloadAll)