diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index a2cce4b60..9d27b3a11 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -1242,7 +1242,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) return true; } -bool Map::CreatureRespawnRelocation(Creature *c) +bool Map::CreatureRespawnRelocation(Creature *c, bool forGridUnload) { float resp_x, resp_y, resp_z, resp_o; c->GetRespawnCoord(resp_x, resp_y, resp_z, &resp_o); @@ -1250,7 +1250,9 @@ bool Map::CreatureRespawnRelocation(Creature *c) CellPair resp_val = MaNGOS::ComputeCellPair(resp_x, resp_y); Cell resp_cell(resp_val); - c->AI()->EnterEvadeMode(); + // in some AI EnterEvadeMode() calls a relocation + if (forGridUnload) + c->AI()->EnterEvadeMode(); c->GetMotionMaster()->Clear(); DEBUG_FILTER_LOG(LOG_FILTER_CREATURE_MOVES, "Creature (GUID: %u Entry: %u) will moved from grid[%u,%u]cell[%u,%u] to respawn grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), c->GetCurrentCell().GridX(), c->GetCurrentCell().GridY(), c->GetCurrentCell().CellX(), c->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY()); diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index 5abf5c5b2..c553ce72f 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -282,7 +282,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj virtual void RemoveAllObjectsInRemoveList(); - bool CreatureRespawnRelocation(Creature *c); // used only in CreatureRelocation and ObjectGridUnloader + bool CreatureRespawnRelocation(Creature *c, bool forGridUnload = false); // used only in CreatureRelocation and ObjectGridUnloader bool CheckGridIntegrity(Creature* c, bool moved) const; diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index 3d1fb93d3..a7fffa72f 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -74,7 +74,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m) if (cur_cell.DiffGrid(resp_cell)) { - c->GetMap()->CreatureRespawnRelocation(c); + c->GetMap()->CreatureRespawnRelocation(c, true); // false result ignored: will be unload with other creatures at grid } }