[11161] Implement Map copy local grid spawn data support.

Currently this functionality not used, but soon planned be used
in connection wiht map persistent state specific pool system data.

In different from grid spawn data stored in ObjectMgr and used for global
(comon for all map copies) spawns from DB data or from gameevent system,
map locla spawn data used for independet grid spawns like expected to be
for pool system case when it will work in full power in instances.
Maybe for something other, like script dependent "static" spawns
not dependent from grid load state.
This commit is contained in:
VladimirMangos 2011-02-14 10:36:35 +03:00
parent 30cb26d86a
commit 387f8a965a
5 changed files with 66 additions and 10 deletions

View file

@ -128,6 +128,38 @@ void MapPersistentState::ClearRespawnTimes()
UnloadIfEmpty();
}
void MapPersistentState::AddCreatureToGrid( uint32 guid, CreatureData const* data )
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
m_gridObjectGuids[cell_id].creatures.insert(guid);
}
void MapPersistentState::RemoveCreatureFromGrid( uint32 guid, CreatureData const* data )
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
m_gridObjectGuids[cell_id].creatures.erase(guid);
}
void MapPersistentState::AddGameobjectToGrid( uint32 guid, GameObjectData const* data )
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
m_gridObjectGuids[cell_id].gameobjects.insert(guid);
}
void MapPersistentState::RemoveGameobjectFromGrid( uint32 guid, GameObjectData const* data )
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
m_gridObjectGuids[cell_id].gameobjects.erase(guid);
}
//== WorldPersistentState functions ========================
bool WorldPersistentState::CanBeUnload() const