From eb8cbae0d5d2e43585300271db86c4bd0bacd58a Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 7 Oct 2011 17:36:23 -0400 Subject: Fix the relocation of creatures across cells. Try to fix #3054. --- src/server/game/Grids/ObjectGridLoader.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/server/game/Grids/ObjectGridLoader.cpp') diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index 58521b76bff..b0e7de88491 100755 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -57,20 +57,8 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m) Creature* c = iter->getSource(); ++iter; - ASSERT(!c->isPet() && "ObjectGridRespawnMover don't must be called for pets"); - - Cell const& cur_cell = c->GetCurrentCell(); - - float resp_x, resp_y, resp_z; - c->GetRespawnCoord(resp_x, resp_y, resp_z); - CellPair resp_val = Trinity::ComputeCellPair(resp_x, resp_y); - Cell resp_cell(resp_val); - - if (cur_cell.DiffGrid(resp_cell)) - { - c->GetMap()->CreatureRespawnRelocation(c); - // false result ignored: will be unload with other creatures at grid - } + ASSERT(!c->isPet() && "ObjectGridRespawnMover must not be called for pets"); + c->GetMap()->CreatureRespawnRelocation(c, true); } } @@ -94,11 +82,11 @@ class ObjectWorldLoader uint32 i_corpses; }; -template void AddUnitState(T* /*obj*/, CellPair const& /*cell_pair*/) +template static void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellPair const& /*cell_pair*/) { } -template<> void AddUnitState(Creature* obj, CellPair const& cell_pair) +template<> static void ObjectGridLoader::SetObjectCell(Creature* obj, CellPair const& cell_pair) { Cell cell(cell_pair); @@ -109,7 +97,7 @@ template void AddObjectHelper(CellPair &cell, GridRefManager &m, uint32 &count, Map* map, T *obj) { obj->GetGridRef().link(&m, obj); - AddUnitState(obj, cell); + ObjectGridLoader::SetObjectCell(obj, cell); obj->AddToWorld(); if (obj->isActiveObject()) map->AddToActive(obj); -- cgit v1.2.3