From 6be65569de44b068ab4221307e8474bf35a9adab Mon Sep 17 00:00:00 2001 From: wincent Date: Tue, 10 Sep 2024 12:40:49 +0200 Subject: [PATCH] Fixed mission related preconditions --- dGame/dUtilities/Preconditions.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/dGame/dUtilities/Preconditions.cpp b/dGame/dUtilities/Preconditions.cpp index cd920863f..e4bd33458 100644 --- a/dGame/dUtilities/Preconditions.cpp +++ b/dGame/dUtilities/Preconditions.cpp @@ -139,21 +139,13 @@ bool Precondition::CheckValue(Entity* player, const uint32_t value, bool evaluat case PreconditionType::DoesNotHaveItem: return inventoryComponent->IsEquipped(value) < count; case PreconditionType::HasAchievement: - mission = missionComponent->GetMission(value); - - return mission == nullptr || mission->GetMissionState() >= eMissionState::COMPLETE; + return missionComponent->GetMissionState(value) >= eMissionState::COMPLETE; case PreconditionType::MissionAvailable: - mission = missionComponent->GetMission(value); - - return mission == nullptr || mission->GetMissionState() >= eMissionState::AVAILABLE; + return missionComponent->GetMissionState(value) >= eMissionState::AVAILABLE; case PreconditionType::OnMission: - mission = missionComponent->GetMission(value); - - return mission == nullptr || mission->GetMissionState() >= eMissionState::ACTIVE; + return missionComponent->GetMissionState(value) >= eMissionState::ACTIVE; case PreconditionType::MissionComplete: - mission = missionComponent->GetMission(value); - - return mission == nullptr ? false : mission->GetMissionState() >= eMissionState::COMPLETE; + return missionComponent->GetMissionState(value) >= eMissionState::COMPLETE; case PreconditionType::PetDeployed: return false; // TODO case PreconditionType::HasFlag: