Update StarQuestManager.cpp
This commit is contained in:
parent
662a376926
commit
4b0b047448
@ -73,10 +73,10 @@ void QuestManager::setUniverseClient(UniverseClient* client) {
|
|||||||
|
|
||||||
void QuestManager::init(World* world) {
|
void QuestManager::init(World* world) {
|
||||||
m_world = world;
|
m_world = world;
|
||||||
for (auto& quest : m_quests) {
|
for (auto& quest : m_quests.values()) {
|
||||||
if (!questValidOnServer(quest.second))
|
if (!questValidOnServer(quest))
|
||||||
continue;
|
continue;
|
||||||
quest.second->init(m_player, world, m_client);
|
quest->init(m_player, world, m_client);
|
||||||
}
|
}
|
||||||
m_trackOnWorldQuests = true;
|
m_trackOnWorldQuests = true;
|
||||||
|
|
||||||
@ -398,19 +398,21 @@ void QuestManager::update(float dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& entry : m_quests) {
|
StringMap<QuestPtr> allQuests = quests();
|
||||||
|
for (auto& entry : allQuests) {
|
||||||
auto quest = entry.second;
|
auto quest = entry.second;
|
||||||
QuestState state = quest->state();
|
QuestState state = quest->state();
|
||||||
bool finished = state == QuestState::Complete || state == QuestState::Failed;
|
bool finished = state == QuestState::Complete || state == QuestState::Failed;
|
||||||
if (state == QuestState::New || (finished && quest->ephemeral() && !quest->showDialog())) {
|
if (state == QuestState::New || (finished && quest->ephemeral() && !quest->showDialog())) {
|
||||||
quest->uninit();
|
quest->uninit();
|
||||||
|
allQuests.remove(entry.first);
|
||||||
m_quests.remove(entry.first);
|
m_quests.remove(entry.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& q : m_quests.values()) {
|
for (auto& q : allQuests) {
|
||||||
if (questValidOnServer(q))
|
if (questValidOnServer(q.second))
|
||||||
q->update(dt);
|
q.second->update(dt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user