fix edge case in quest episode detection

This commit is contained in:
Martin Michelsen
2024-06-22 15:22:52 -07:00
parent 9ca1b79409
commit a88795d8b9
+5 -1
View File
@@ -1667,9 +1667,10 @@ Episode find_quest_episode_from_script(const void* data, size_t size, Version ve
throw logic_error("invalid quest version"); throw logic_error("invalid quest version");
} }
const auto& opcodes = opcodes_for_version(version);
unordered_set<Episode> found_episodes; unordered_set<Episode> found_episodes;
try {
const auto& opcodes = opcodes_for_version(version);
// The set_episode opcode should always be in the first function (0) // The set_episode opcode should always be in the first function (0)
StringReader cmd_r = r.sub(code_offset + r.pget_u32l(function_table_offset)); StringReader cmd_r = r.sub(code_offset + r.pget_u32l(function_table_offset));
@@ -1762,6 +1763,9 @@ Episode find_quest_episode_from_script(const void* data, size_t size, Version ve
} }
} }
} }
} catch (const exception& e) {
log_warning("Cannot determine episode from quest script (%s)", e.what());
}
if (found_episodes.size() > 1) { if (found_episodes.size() > 1) {
throw runtime_error("multiple episodes found"); throw runtime_error("multiple episodes found");