aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
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
parent62ac0d4a1c363e3088773e589264ddf33958c183 (diff)
Scripts: Fixed possible crashes caused by passing nullptr to Trinity::WorldObjectListSearcher constructor
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/ExilesReach/zone_exiles_reach.cpp4
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp7
2 files changed, 6 insertions, 5 deletions
diff --git a/src/server/scripts/ExilesReach/zone_exiles_reach.cpp b/src/server/scripts/ExilesReach/zone_exiles_reach.cpp
index e1b0033f523..7eb00fabbb8 100644
--- a/src/server/scripts/ExilesReach/zone_exiles_reach.cpp
+++ b/src/server/scripts/ExilesReach/zone_exiles_reach.cpp
@@ -4647,8 +4647,8 @@ struct at_briarpatch_to_plains : AreaTriggerAI
std::vector<WorldObject*> objs;
Trinity::ObjectEntryAndPrivateOwnerIfExistsCheck check(player->GetGUID(), conversationId);
- Trinity::WorldObjectListSearcher<Trinity::ObjectEntryAndPrivateOwnerIfExistsCheck> checker(nullptr, objs, check, GRID_MAP_TYPE_MASK_CONVERSATION);
- Cell::VisitGridObjects(player, checker, 100.0f);
+ Trinity::WorldObjectListSearcher searcher(PhasingHandler::GetAlwaysVisiblePhaseShift(), objs, check, GRID_MAP_TYPE_MASK_CONVERSATION);
+ Cell::VisitGridObjects(player, searcher, 100.0f);
if (objs.empty())
Conversation::CreateConversation(conversationId, player, *player, player->GetGUID(), nullptr);
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