From 9502b05ea4587f2c060608718486d5c8d5bc3ac5 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:42:32 +1100 Subject: [PATCH] Update StarQuestManager.cpp --- source/game/StarQuestManager.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/game/StarQuestManager.cpp b/source/game/StarQuestManager.cpp index 4e88500..4dbc652 100644 --- a/source/game/StarQuestManager.cpp +++ b/source/game/StarQuestManager.cpp @@ -398,19 +398,21 @@ void QuestManager::update(float dt) { } } - StringMap allQuests = quests(); - for (auto& entry : allQuests) { + List expiredQuests; + for (auto& entry : m_quests) { auto quest = entry.second; QuestState state = quest->state(); bool finished = state == QuestState::Complete || state == QuestState::Failed; if (state == QuestState::New || (finished && quest->ephemeral() && !quest->showDialog())) { quest->uninit(); - allQuests.remove(entry.first); - m_quests.remove(entry.first); + expiredQuests.append(entry.first); } } - for (auto& q : allQuests) { + for (auto& questId : expiredQuests) + m_quests.remove(questId); + + for (auto& q : m_quests) { if (questValidOnServer(q.second)) q.second->update(dt); }