diff options
author | megamage <none@none> | 2008-12-20 12:27:55 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-12-20 12:27:55 -0600 |
commit | f52a5a6dc722bcb54df57d6ae0a879457689de3e (patch) | |
tree | f1605fbd55a222fdb1242b1402be0349b0fa65ce /src | |
parent | 41e27a9b4026685f4ff6d5f23ec49510d773b028 (diff) |
*Fix a bug that stealth causes nearby players lag.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Player.cpp | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e3e98805ceb..9bbd48e1862 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16686,33 +16686,14 @@ void Player::SetRestBonus (float rest_bonus_new) void Player::HandleStealthedUnitsDetection() { std::list<Unit*> stealthedUnits; - - CellPair p(Trinity::ComputeCellPair(GetPositionX(),GetPositionY())); - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); - Trinity::AnyStealthedCheck u_check; Trinity::UnitListSearcher<Trinity::AnyStealthedCheck > searcher(stealthedUnits, u_check); + VisitNearbyObject(World::GetMaxVisibleDistance(), searcher); - TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyStealthedCheck >, WorldTypeMapContainer > world_unit_searcher(searcher); - TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyStealthedCheck >, GridTypeMapContainer > grid_unit_searcher(searcher); - - CellLock<GridReadGuard> cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); - cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); - - for (std::list<Unit*>::iterator i = stealthedUnits.begin(); i != stealthedUnits.end();) + for (std::list<Unit*>::iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i) { - if((*i)==this) - { - i = stealthedUnits.erase(i); - continue; - } - - if ((*i)->isVisibleForOrDetect(this,true)) + if (!HaveAtClient(*i) && canSeeOrDetect(*i, true)) { - (*i)->SendUpdateToPlayer(this); m_clientGUIDs.insert((*i)->GetGUID()); @@ -16734,12 +16715,7 @@ void Player::HandleStealthedUnitsDetection() ((Unit*)(*i))->SendAttackStart(((Unit*)(*i))->getVictim()); } } - - i = stealthedUnits.erase(i); - continue; } - - ++i; } } |