don't check missing categories during quest indexing

This commit is contained in:
Martin Michelsen
2023-11-13 14:25:31 -08:00
parent d976452e00
commit c5f047dc0d
3 changed files with 10 additions and 4 deletions
+7 -1
View File
@@ -433,7 +433,8 @@ shared_ptr<const VersionedQuest> Quest::version(QuestScriptVersion v, uint8_t la
QuestIndex::QuestIndex(
const string& directory,
std::shared_ptr<const QuestCategoryIndex> category_index)
std::shared_ptr<const QuestCategoryIndex> category_index,
bool is_ep3)
: directory(directory),
category_index(category_index) {
@@ -443,6 +444,11 @@ QuestIndex::QuestIndex(
map<string, shared_ptr<const string>> json_files;
map<string, uint32_t> 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<string, shared_ptr<const string>>& files, const string& name, string&& value) {
if (categories.emplace(name, cat.category_id).first->second != cat.category_id) {
+1 -1
View File
@@ -120,7 +120,7 @@ struct QuestIndex {
std::map<uint32_t, std::shared_ptr<Quest>> quests_by_number;
QuestIndex(const std::string& directory, std::shared_ptr<const QuestCategoryIndex> category_index);
QuestIndex(const std::string& directory, std::shared_ptr<const QuestCategoryIndex> category_index, bool is_ep3);
std::shared_ptr<const Quest> get(uint32_t quest_number) const;
std::vector<std::shared_ptr<const Quest>> filter(uint32_t category_id, QuestScriptVersion version) const;
+2 -2
View File
@@ -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() {