From 0b5406dd882c6d96bc1be6fd0a78375c3b316415 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 11 Jan 2024 20:56:24 +0100 Subject: Core/Conditions: Refactor ConditionMgr internals to get rid of separate containers for some condition source types --- src/server/game/Globals/ObjectMgr.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/server/game/Globals/ObjectMgr.cpp') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index d04ff396c13..b61f8c7e4b5 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6900,7 +6900,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardInZone(WorldLocation con if (conditionObject) { - if (!sConditionMgr->IsObjectMeetToConditions(conditionSource, data.Conditions)) + if (!data.Conditions.Meets(conditionSource)) continue; if (int16(entry->Loc.GetMapId()) == mapEntry->ParentMapID && !conditionObject->GetPhaseShift().HasVisibleMapId(entry->Loc.GetMapId())) @@ -6909,15 +6909,18 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyardInZone(WorldLocation con else if (team != 0) { bool teamConditionMet = true; - for (Condition const* cond : data.Conditions) + if (std::shared_ptr> conditions = data.Conditions.Conditions.lock()) { - if (cond->ConditionType != CONDITION_TEAM) - continue; + for (Condition const& cond : *conditions) + { + if (cond.ConditionType != CONDITION_TEAM) + continue; - if (cond->ConditionValue1 == team) - continue; + if (cond.ConditionValue1 == team) + continue; - teamConditionMet = false; + teamConditionMet = false; + } } if (!teamConditionMet) -- cgit v1.2.3