mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-12 19:18:28 +00:00
fix: racing meta missions and undefined behavior in mission progression
Tested that missions can still be completed Tested that racing meta tasks are now actually possible TODO: Tested that old characters with incomplete meta missions are brought up to speed with their current progress
This commit is contained in:
@@ -407,9 +407,7 @@ void Mission::Catchup() {
|
||||
task->Progress(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type == eMissionTaskType::PLAYER_FLAG) {
|
||||
} else if (type == eMissionTaskType::PLAYER_FLAG) {
|
||||
for (int32_t target : task->GetAllTargets()) {
|
||||
const auto flag = GetCharacter()->GetPlayerFlag(target);
|
||||
|
||||
@@ -423,6 +421,24 @@ void Mission::Catchup() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (type == eMissionTaskType::RACING) {
|
||||
// check if its a racing meta task ("4") and then set its progress to the current completed missions in all tasks
|
||||
const auto& clientInfo = task->GetClientInfo();
|
||||
if (clientInfo.taskParam1.starts_with("4")) {
|
||||
// Each target is racing mission that needs to be completed.
|
||||
// If its completed, progress the meta task by 1.
|
||||
// at the end set the task progress to avoid sending excess msgs across the wire
|
||||
uint32_t progress = 0;
|
||||
for (const auto& target : task->GetAllTargets()) {
|
||||
if (target == 0) continue;
|
||||
|
||||
auto* racingMission = m_MissionComponent->GetMission(target);
|
||||
if (racingMission != nullptr && racingMission->IsComplete()) {
|
||||
progress++;
|
||||
}
|
||||
}
|
||||
task->SetProgress(progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user