aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Chat/Chat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Chat/Chat.cpp')
-rw-r--r--src/server/game/Chat/Chat.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index ed6aa52da5a..52c52726b73 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -796,15 +796,11 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(ObjectGuid::Lo
if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object
{
- // search near player then
- CellCoord p(Trinity::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY()));
- Cell cell(p);
+ auto bounds = pl->GetMap()->GetGameObjectBySpawnIdStore().equal_range(lowguid);
+ if (bounds.first == bounds.second)
+ return nullptr;
- Trinity::GameObjectWithDbGUIDCheck go_check(*pl, lowguid);
- Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(pl, obj, go_check);
-
- TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
- cell.Visit(p, object_checker, *pl->GetMap(), *pl, pl->GetGridActivationRange());
+ return bounds.first->second;
}
return obj;