mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
cleanup enums to make them more consistent
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "Mail.h"
|
||||
#include "MissionPrerequisites.h"
|
||||
#include "AchievementCacheKey.h"
|
||||
#include "eMissionState.h"
|
||||
|
||||
// MARK: Mission Component
|
||||
|
||||
@@ -53,11 +54,11 @@ Mission* MissionComponent::GetMission(const uint32_t missionId) const {
|
||||
}
|
||||
|
||||
|
||||
MissionState MissionComponent::GetMissionState(const uint32_t missionId) const {
|
||||
eMissionState MissionComponent::GetMissionState(const uint32_t missionId) const {
|
||||
auto* mission = GetMission(missionId);
|
||||
|
||||
if (mission == nullptr) {
|
||||
return CanAccept(missionId) ? MissionState::MISSION_STATE_AVAILABLE : MissionState::MISSION_STATE_UNKNOWN;
|
||||
return CanAccept(missionId) ? eMissionState::AVAILABLE : eMissionState::UNKNOWN;
|
||||
}
|
||||
|
||||
return mission->GetMissionState();
|
||||
@@ -143,7 +144,7 @@ void MissionComponent::RemoveMission(uint32_t missionId) {
|
||||
m_Missions.erase(missionId);
|
||||
}
|
||||
|
||||
void MissionComponent::Progress(MissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count, bool ignoreAchievements) {
|
||||
void MissionComponent::Progress(eMissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count, bool ignoreAchievements) {
|
||||
for (const auto& pair : m_Missions) {
|
||||
auto* mission = pair.second;
|
||||
|
||||
@@ -215,7 +216,7 @@ void MissionComponent::ForceProgressTaskType(const uint32_t missionId, const uin
|
||||
}
|
||||
|
||||
for (auto* element : mission->GetTasks()) {
|
||||
if (element->GetType() != static_cast<MissionTaskType>(taskType)) continue;
|
||||
if (element->GetType() != static_cast<eMissionTaskType>(taskType)) continue;
|
||||
|
||||
element->AddProgress(value);
|
||||
}
|
||||
@@ -253,7 +254,7 @@ void MissionComponent::ForceProgressValue(uint32_t missionId, uint32_t taskType,
|
||||
}
|
||||
|
||||
for (auto* element : mission->GetTasks()) {
|
||||
if (element->GetType() != static_cast<MissionTaskType>(taskType) || !element->InAllTargets(value)) continue;
|
||||
if (element->GetType() != static_cast<eMissionTaskType>(taskType) || !element->InAllTargets(value)) continue;
|
||||
|
||||
element->AddProgress(1);
|
||||
}
|
||||
@@ -281,7 +282,7 @@ bool MissionComponent::GetMissionInfo(uint32_t missionId, CDMissions& result) {
|
||||
|
||||
#define MISSION_NEW_METHOD
|
||||
|
||||
bool MissionComponent::LookForAchievements(MissionTaskType type, int32_t value, bool progress, LWOOBJID associate, const std::string& targets, int32_t count) {
|
||||
bool MissionComponent::LookForAchievements(eMissionTaskType type, int32_t value, bool progress, LWOOBJID associate, const std::string& targets, int32_t count) {
|
||||
#ifdef MISSION_NEW_METHOD
|
||||
// Query for achievments, using the cache
|
||||
const auto& result = QueryAchievements(type, value, targets);
|
||||
@@ -390,7 +391,7 @@ bool MissionComponent::LookForAchievements(MissionTaskType type, int32_t value,
|
||||
#endif
|
||||
}
|
||||
|
||||
const std::vector<uint32_t>& MissionComponent::QueryAchievements(MissionTaskType type, int32_t value, const std::string targets) {
|
||||
const std::vector<uint32_t>& MissionComponent::QueryAchievements(eMissionTaskType type, int32_t value, const std::string targets) {
|
||||
// Create a hash which represent this query for achievements
|
||||
AchievementCacheKey toFind;
|
||||
toFind.SetType(type);
|
||||
@@ -484,7 +485,7 @@ bool MissionComponent::RequiresItem(const LOT lot) {
|
||||
}
|
||||
|
||||
for (auto* task : mission->GetTasks()) {
|
||||
if (task->IsComplete() || task->GetType() != MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION) {
|
||||
if (task->IsComplete() || task->GetType() != eMissionTaskType::GATHER) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -496,7 +497,7 @@ bool MissionComponent::RequiresItem(const LOT lot) {
|
||||
}
|
||||
}
|
||||
|
||||
const auto required = LookForAchievements(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, lot, false);
|
||||
const auto required = LookForAchievements(eMissionTaskType::GATHER, lot, false);
|
||||
|
||||
return required;
|
||||
}
|
||||
|
Reference in New Issue
Block a user