diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 2ff2f92c1..24f9652bd 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -522,7 +522,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) // Spawn if necessary (loaded grids only) Map* map = const_cast(MapManager::Instance().CreateBaseMap(data->mapid)); // We use spawn coords to spawn - if(!map->Instanceable() && !map->IsRemovalGrid(data->posX,data->posY)) + if(!map->Instanceable() && map->IsLoaded(data->posX,data->posY)) { Creature* pCreature = new Creature; //sLog.outDebug("Spawning creature %u",*itr); @@ -555,7 +555,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) // this base map checked as non-instanced and then only existed Map* map = const_cast(MapManager::Instance().CreateBaseMap(data->mapid)); // We use current coords to unspawn, not spawn coords since creature can have changed grid - if(!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY)) + if(!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { GameObject* pGameobject = new GameObject; //sLog.outDebug("Spawning gameobject %u", *itr); diff --git a/src/game/Map.h b/src/game/Map.h index af5b94cd6..1a458bda8 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -296,6 +296,12 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj return( !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL ); } + bool IsLoaded(float x, float y) const + { + GridPair p = MaNGOS::ComputeGridPair(x, y); + return loaded(p); + } + bool GetUnloadLock(const GridPair &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); } void SetUnloadLock(const GridPair &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); } void LoadGrid(const Cell& cell, bool no_unload = false); diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index e038add5c..fe38d3f82 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -243,7 +243,7 @@ bool PoolGroup::Spawn1Object(uint32 guid) // Spawn if necessary (loaded grids only) Map* map = const_cast(MapManager::Instance().CreateBaseMap(data->mapid)); // We use spawn coords to spawn - if (!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY)) + if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { Creature* pCreature = new Creature; //sLog.outDebug("Spawning creature %u",guid); @@ -273,7 +273,7 @@ bool PoolGroup::Spawn1Object(uint32 guid) // this base map checked as non-instanced and then only existed Map* map = const_cast(MapManager::Instance().CreateBaseMap(data->mapid)); // We use current coords to unspawn, not spawn coords since creature can have changed grid - if (!map->Instanceable() && !map->IsRemovalGrid(data->posX, data->posY)) + if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { GameObject* pGameobject = new GameObject; //sLog.outDebug("Spawning gameobject %u", guid); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d290c9a97..0fac39084 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 "8679" + #define REVISION_NR "8680" #endif // __REVISION_NR_H__