A more conservative way to fix crash #2892.
This commit is contained in:
@@ -824,22 +824,23 @@ void Map::MoveAllCreaturesInMoveList()
|
|||||||
}
|
}
|
||||||
else
|
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
|
// 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
|
// creature coordinates will be updated and notifiers send
|
||||||
else if (!CreatureRespawnRelocation(c))
|
if (!CreatureRespawnRelocation(c))
|
||||||
{
|
{
|
||||||
// ... or unload (if respawn grid also not loaded)
|
// ... or unload (if respawn grid also not loaded)
|
||||||
#ifdef TRINITY_DEBUG
|
#ifdef TRINITY_DEBUG
|
||||||
sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", c->GetGUIDLow(), c->GetEntry());
|
sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", c->GetGUIDLow(), c->GetEntry());
|
||||||
#endif
|
#endif
|
||||||
|
//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);
|
AddObjectToRemoveList(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -933,7 +934,7 @@ bool Map::CreatureRespawnRelocation(Creature *c)
|
|||||||
c->UpdateObjectVisibility(false);
|
c->UpdateObjectVisibility(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user