diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Map.cpp | 7 | ||||
-rw-r--r-- | src/game/Map.h | 1 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp index c2acd65e72e..152a078868b 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -454,6 +454,13 @@ Map::LoadGrid(const Cell& cell, bool no_unload) //LoadVMap(63-cell.GridX(),63-cell.GridY()); } +void Map::LoadGrid(float x, float y) +{ + CellPair pair = Trinity::ComputeCellPair(x, y); + Cell cell(pair); + EnsureGridLoadedForPlayer(cell, NULL, false); +} + bool Map::Add(Player *player) { player->GetMapRef().link(this, player); diff --git a/src/game/Map.h b/src/game/Map.h index a8e0ca73d33..23b2ea1f3fa 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -161,6 +161,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O bool GetUnloadFlag(const GridPair &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadFlag(); } void SetUnloadFlag(const GridPair &p, bool unload) { getNGrid(p.x_coord, p.y_coord)->setUnloadFlag(unload); } void LoadGrid(const Cell& cell, bool no_unload = false); + void LoadGrid(float x, float y); bool UnloadGrid(const uint32 &x, const uint32 &y, bool pForce); virtual void UnloadAll(bool pForce); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index f53338b023d..271b4ad68da 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -3466,10 +3466,8 @@ void Spell::EffectAddFarsight(uint32 i) dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002); m_caster->AddDynObject(dynObj); - CellPair pair = Trinity::ComputeCellPair(dynObj->GetPositionX(), dynObj->GetPositionY()); - Cell cell(pair); Map* map = dynObj->GetMap(); - map->EnsureGridLoadedForPlayer(cell, NULL, false); // In case the spell is casted into a different grid by player + map->LoadGrid(dynObj->GetPositionX(), dynObj->GetPositionY()); // In case the spell is casted into a different grid by player map->Add(dynObj); map->SwitchGridContainers(dynObj, true); // Needed for forwarding player packets dynObj->setActive(true); // Keep the grid updated even if there are no players in it |