diff options
author | megamage <none@none.none> | 2011-12-07 13:02:44 -0500 |
---|---|---|
committer | megamage <none@none.none> | 2011-12-07 13:02:44 -0500 |
commit | 6a648c01a46e45a38bbbfc9b5bfa0a8aa114a16c (patch) | |
tree | f382e0c6072d641305f2a7c1ef0e93477b6d48d3 /src/server/game/Grids/ObjectGridLoader.cpp | |
parent | f5b3553bb3e6cf9d055cfdc7f230e3ddaeea559b (diff) |
Some clean up of grid system.
Diffstat (limited to 'src/server/game/Grids/ObjectGridLoader.cpp')
-rwxr-xr-x | src/server/game/Grids/ObjectGridLoader.cpp | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index 56c6410e6d7..cc5e3f5158a 100755 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -44,6 +44,7 @@ void ObjectGridEvacuator::Visit(CreatureMapType &m) } // for loading world object at grid loading (Corpses) +//TODO: to implement npc on transport, also need to load npcs at grid loading class ObjectWorldLoader { public: @@ -138,38 +139,23 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellCoord &cell, CorpseMapTyp void ObjectGridLoader::Visit(GameObjectMapType &m) { - uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); - uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellCoord cellCoord(x, y); - uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; - - CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); - + CellCoord cellCoord = i_cell.GetCellCoord(); + CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId()); LoadHelper(cell_guids.gameobjects, cellCoord, m, i_gameObjects, i_map); } -void -ObjectGridLoader::Visit(CreatureMapType &m) +void ObjectGridLoader::Visit(CreatureMapType &m) { - uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); - uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellCoord cellCoord(x, y); - uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; - - CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cell_id); - + CellCoord cellCoord = i_cell.GetCellCoord(); + CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId()); LoadHelper(cell_guids.creatures, cellCoord, m, i_creatures, i_map); } void ObjectWorldLoader::Visit(CorpseMapType &m) { - uint32 x = (i_cell.GridX()*MAX_NUMBER_OF_CELLS) + i_cell.CellX(); - uint32 y = (i_cell.GridY()*MAX_NUMBER_OF_CELLS) + i_cell.CellY(); - CellCoord cellCoord(x, y); - uint32 cell_id = (cellCoord.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cellCoord.x_coord; - + CellCoord cellCoord = i_cell.GetCellCoord(); // corpses are always added to spawn mode 0 and they are spawned by their instance id - CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), 0, cell_id); + CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), 0, cellCoord.GetId()); LoadHelper(cell_guids.corpses, cellCoord, m, i_corpses, i_map); } |