[7339] Attempt lock spawn grid only for active non-pet creatures.

This commit is contained in:
VladimirMangos 2009-02-26 01:39:45 +03:00
parent f35ffca03e
commit b4dbeb3bc8
4 changed files with 20 additions and 20 deletions

View file

@ -463,6 +463,7 @@ Map::Add(T *obj)
AddToGrid(obj,grid,cell);
obj->AddToWorld();
if(obj->isActiveObject())
AddToActive(obj);
DEBUG_LOG("Object %u enters grid[%u,%u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
@ -762,6 +763,7 @@ Map::Remove(T *obj, bool remove)
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert( grid != NULL );
if(obj->isActiveObject())
RemoveFromActive(obj);
obj->RemoveFromWorld();
@ -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);

View file

@ -358,14 +358,11 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
template<class T>
void AddToActiveHelper(T* obj)
{
if(obj->isActiveObject())
m_activeNonPlayers.insert(obj);
}
template<class T>
void RemoveFromActiveHelper(T* obj)
{
if(obj->isActiveObject())
{
// Map::Update for active object in proccess
if(m_activeNonPlayersIter != m_activeNonPlayers.end())
@ -378,7 +375,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
else
m_activeNonPlayers.erase(obj);
}
}
};
enum InstanceResetMethod

View file

@ -125,6 +125,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
addUnitState(obj,cell);
obj->AddToWorld();
if(obj->isActiveObject())
map->AddToActive(obj);
++count;
@ -152,6 +153,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType
addUnitState(obj,cell);
obj->AddToWorld();
if(obj->isActiveObject())
map->AddToActive(obj);
++count;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7338"
#define REVISION_NR "7339"
#endif // __REVISION_NR_H__