aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/OutdoorPvP
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-06-29 00:23:21 +0200
committerShauren <shauren.trinity@gmail.com>2025-06-29 00:23:21 +0200
commit5334467f493eb16141f4ad0bce956bc3e19244a0 (patch)
treec36dd66d4484771ac3553effa08f975cfdc0c03f /src/server/scripts/OutdoorPvP
parent62ac0d4a1c363e3088773e589264ddf33958c183 (diff)
Scripts: Fixed possible crashes caused by passing nullptr to Trinity::WorldObjectListSearcher constructor
Diffstat (limited to 'src/server/scripts/OutdoorPvP')
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index 98c09080b7d..c41dbff9788 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -22,6 +22,7 @@
#include "GridNotifiersImpl.h"
#include "Map.h"
#include "ObjectMgr.h"
+#include "PhasingHandler.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WorldStatePackets.h"
@@ -155,12 +156,12 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() const
{
Position searchCenter = { -1572.57f, 7945.3f, -22.475f, 2.05949f };
- std::vector<WorldObject*> guards;
+ std::vector<Creature*> guards;
Trinity::ObjectEntryAndPrivateOwnerIfExistsCheck check(ObjectGuid::Empty, GetControllingFaction() == HORDE ? 18192 : 18256);
- Trinity::WorldObjectListSearcher<Trinity::ObjectEntryAndPrivateOwnerIfExistsCheck> searcher(nullptr, guards, check, GRID_MAP_TYPE_MASK_CREATURE);
+ Trinity::CreatureListSearcher searcher(PhasingHandler::GetEmptyPhaseShift(), guards, check);
Cell::VisitGridObjects(searchCenter.GetPositionX(), searchCenter.GetPositionY(), m_PvP->GetMap(), searcher, SIZE_OF_GRIDS);
- return std::count_if(guards.begin(), guards.end(), [](WorldObject* guard) { return guard->IsUnit() && guard->ToUnit()->IsAlive(); });
+ return std::ranges::count_if(guards, [](Creature const* guard) { return guard->IsAlive(); });
}
Team OPvPCapturePointNA::GetControllingFaction() const