From dfe924061f45b1336a72eb2636a3344f13a1a01a Mon Sep 17 00:00:00 2001 From: wincent Date: Thu, 12 Sep 2024 15:31:36 +0200 Subject: [PATCH] Amend preconditions fix --- dGame/dUtilities/Preconditions.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dGame/dUtilities/Preconditions.cpp b/dGame/dUtilities/Preconditions.cpp index e4bd3345..a0aac27e 100644 --- a/dGame/dUtilities/Preconditions.cpp +++ b/dGame/dUtilities/Preconditions.cpp @@ -139,12 +139,19 @@ bool Precondition::CheckValue(Entity* player, const uint32_t value, bool evaluat case PreconditionType::DoesNotHaveItem: return inventoryComponent->IsEquipped(value) < count; case PreconditionType::HasAchievement: + if (missionComponent == nullptr) return false; return missionComponent->GetMissionState(value) >= eMissionState::COMPLETE; case PreconditionType::MissionAvailable: - return missionComponent->GetMissionState(value) >= eMissionState::AVAILABLE; + if (missionComponent == nullptr) return false; + return missionComponent->GetMissionState(value) == eMissionState::AVAILABLE || missionComponent->GetMissionState(value) == eMissionState::COMPLETE_AVAILABLE; case PreconditionType::OnMission: - return missionComponent->GetMissionState(value) >= eMissionState::ACTIVE; + if (missionComponent == nullptr) return false; + return missionComponent->GetMissionState(value) == eMissionState::ACTIVE || + missionComponent->GetMissionState(value) == eMissionState::COMPLETE_ACTIVE || + missionComponent->GetMissionState(value) == eMissionState::READY_TO_COMPLETE || + missionComponent->GetMissionState(value) == eMissionState::COMPLETE_READY_TO_COMPLETE; case PreconditionType::MissionComplete: + if (missionComponent == nullptr) return false; return missionComponent->GetMissionState(value) >= eMissionState::COMPLETE; case PreconditionType::PetDeployed: return false; // TODO