diff options
author | megamage <none@none> | 2009-03-05 09:17:57 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-05 09:17:57 -0600 |
commit | c1ea842cf77506236803b0524e930bcbaa6e1e8b (patch) | |
tree | feacc9d96f562fd0daf3432392fe98cb61b54692 /src/game/Map.cpp | |
parent | 19ce0bb39ff3d4d5568410e29fa5372623735fbb (diff) | |
parent | 465b10fc60a1f135ec26f09fc88d673a1e73a95d (diff) |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Map.cpp')
-rw-r--r-- | src/game/Map.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 493e5b4b112..43676bd1dc6 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -257,7 +257,7 @@ template<> void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell) { // add to world object registry in grid - if(obj->isPet() || obj->HasSharedVision() || obj->isVehicle()) + if(obj->isPet() || obj->isVehicle() || obj->IsTempWorldObject) { (*grid)(cell.CellX(), cell.CellY()).AddWorldObject<Creature>(obj, obj->GetGUID()); } @@ -309,7 +309,7 @@ template<> void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell) { // remove from world object registry in grid - if(obj->isPet() || obj->HasSharedVision() || obj->isVehicle()) + if(obj->isPet() || obj->isVehicle() || obj->IsTempWorldObject) { (*grid)(cell.CellX(), cell.CellY()).RemoveWorldObject<Creature>(obj, obj->GetGUID()); } @@ -339,20 +339,25 @@ void Map::SwitchGridContainers(T* obj, bool on) if(on) { - if(!grid.RemoveGridObject<T>(obj, obj->GetGUID()) + grid.RemoveGridObject<T>(obj, obj->GetGUID()); + grid.AddWorldObject<T>(obj, obj->GetGUID()); + /*if(!grid.RemoveGridObject<T>(obj, obj->GetGUID()) || !grid.AddWorldObject<T>(obj, obj->GetGUID())) { assert(false); - } + }*/ } else { - if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID()) + grid.RemoveWorldObject<T>(obj, obj->GetGUID()); + grid.AddGridObject<T>(obj, obj->GetGUID()); + /*if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID()) || !grid.AddGridObject<T>(obj, obj->GetGUID())) { assert(false); - } + }*/ } + obj->IsTempWorldObject = on; } template void Map::SwitchGridContainers(Creature *, bool); @@ -1035,6 +1040,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) RemoveFromGrid(c,getNGrid(old_cell.GridX(), old_cell.GridY()),old_cell); AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); + c->SetCurrentCell(new_cell); return true; } @@ -1048,10 +1054,9 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) #endif RemoveFromGrid(c,getNGrid(old_cell.GridX(), old_cell.GridY()),old_cell); - { - EnsureGridCreated(GridPair(new_cell.GridX(), new_cell.GridY())); - AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); - } + EnsureGridCreated(GridPair(new_cell.GridX(), new_cell.GridY())); + AddToGrid(c,getNGrid(new_cell.GridX(), new_cell.GridY()),new_cell); + c->SetCurrentCell(new_cell); return true; } |