Skip to content

Commit

Permalink
don't check missing categories during quest indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzziqersoftware committed Nov 13, 2023
1 parent d976452 commit c5f047d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/Quest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/Quest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/ServerState.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit c5f047d

Please sign in to comment.