diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 18cc4117403..cafb3464ca1 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -463,7 +463,8 @@ Map::Add(T *obj) AddToGrid(obj,grid,cell); obj->AddToWorld(); - AddToActive(obj); + if(obj->isActiveObject()) + AddToActive(obj); DEBUG_LOG("Object %u enters grid[%u,%u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY()); @@ -762,7 +763,8 @@ Map::Remove(T *obj, bool remove) NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); assert( grid != NULL ); - RemoveFromActive(obj); + if(obj->isActiveObject()) + RemoveFromActive(obj); obj->RemoveFromWorld(); RemoveFromGrid(obj,grid,cell); @@ -1623,7 +1625,7 @@ void Map::AddToActive( Creature* c ) AddToActiveHelper(c); // also not allow unloading spawn grid to prevent creating creature clone at load - if(c->GetDBTableGUIDLow()) + if(!c->isPet() && c->GetDBTableGUIDLow()) { float x,y,z; c->GetRespawnCoord(x,y,z); @@ -1644,7 +1646,7 @@ void Map::RemoveFromActive( Creature* c ) RemoveFromActiveHelper(c); // also allow unloading spawn grid - if(c->GetDBTableGUIDLow()) + if(!c->isPet() && c->GetDBTableGUIDLow()) { float x,y,z; c->GetRespawnCoord(x,y,z); diff --git a/src/game/Map.h b/src/game/Map.h index 3a9356f88f5..80f04267440 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -358,26 +358,22 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj template void AddToActiveHelper(T* obj) { - if(obj->isActiveObject()) - m_activeNonPlayers.insert(obj); + m_activeNonPlayers.insert(obj); } template void RemoveFromActiveHelper(T* obj) { - if(obj->isActiveObject()) + // Map::Update for active object in proccess + if(m_activeNonPlayersIter != m_activeNonPlayers.end()) { - // Map::Update for active object in proccess - if(m_activeNonPlayersIter != m_activeNonPlayers.end()) - { - ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj); - if(itr==m_activeNonPlayersIter) - ++m_activeNonPlayersIter; - m_activeNonPlayers.erase(itr); - } - else - m_activeNonPlayers.erase(obj); + ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj); + if(itr==m_activeNonPlayersIter) + ++m_activeNonPlayersIter; + m_activeNonPlayers.erase(itr); } + else + m_activeNonPlayers.erase(obj); } }; diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index 9b944893e0f..04a343d3681 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -125,7 +125,8 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager & addUnitState(obj,cell); obj->AddToWorld(); - map->AddToActive(obj); + if(obj->isActiveObject()) + map->AddToActive(obj); ++count; @@ -152,7 +153,8 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType addUnitState(obj,cell); obj->AddToWorld(); - map->AddToActive(obj); + if(obj->isActiveObject()) + map->AddToActive(obj); ++count; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d791b16d793..cd01be3265c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7338" + #define REVISION_NR "7339" #endif // __REVISION_NR_H__