From c5f047dc0d56a75406dc2b045f183ffb055c1a8b Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 13 Nov 2023 14:25:31 -0800 Subject: [PATCH] don't check missing categories during quest indexing --- src/Quest.cc | 8 +++++++- src/Quest.hh | 2 +- src/ServerState.cc | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Quest.cc b/src/Quest.cc index 11f0e77d..b0dfc85c 100644 --- a/src/Quest.cc +++ b/src/Quest.cc @@ -433,7 +433,8 @@ shared_ptr Quest::version(QuestScriptVersion v, uint8_t la QuestIndex::QuestIndex( const string& directory, - std::shared_ptr category_index) + std::shared_ptr category_index, + bool is_ep3) : directory(directory), category_index(category_index) { @@ -443,6 +444,11 @@ QuestIndex::QuestIndex( map> json_files; map categories; for (const auto& cat : this->category_index->categories) { + // Don't index Ep3 download categories for non-Ep3 quest indexing, and vice + // versa + if (is_ep3 == !(cat.flags & QuestCategoryIndex::Category::Flag::EP3_DOWNLOAD)) { + continue; + } auto add_file = [&](map>& files, const string& name, string&& value) { if (categories.emplace(name, cat.category_id).first->second != cat.category_id) { diff --git a/src/Quest.hh b/src/Quest.hh index 1550a739..f80d7184 100644 --- a/src/Quest.hh +++ b/src/Quest.hh @@ -120,7 +120,7 @@ struct QuestIndex { std::map> quests_by_number; - QuestIndex(const std::string& directory, std::shared_ptr category_index); + QuestIndex(const std::string& directory, std::shared_ptr category_index, bool is_ep3); std::shared_ptr get(uint32_t quest_number) const; std::vector> filter(uint32_t category_id, QuestScriptVersion version) const; diff --git a/src/ServerState.cc b/src/ServerState.cc index f87e0973..65059372 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -1065,9 +1065,9 @@ void ServerState::resolve_ep3_card_names() { void ServerState::load_quest_index() { config_log.info("Collecting quests"); - this->default_quest_index.reset(new QuestIndex("system/quests", this->quest_category_index)); + this->default_quest_index.reset(new QuestIndex("system/quests", this->quest_category_index, false)); config_log.info("Collecting Episode 3 download quests"); - this->ep3_download_quest_index.reset(new QuestIndex("system/ep3/maps-download", this->quest_category_index)); + this->ep3_download_quest_index.reset(new QuestIndex("system/ep3/maps-download", this->quest_category_index, true)); } void ServerState::compile_functions() {