diff --git a/soh/soh/Enhancements/randomizer/dungeon.cpp b/soh/soh/Enhancements/randomizer/dungeon.cpp index d83bc9251..423c8666e 100644 --- a/soh/soh/Enhancements/randomizer/dungeon.cpp +++ b/soh/soh/Enhancements/randomizer/dungeon.cpp @@ -1419,17 +1419,16 @@ std::array Dungeons::GetDungeonList() { size_t Dungeons::GetDungeonListSize() const { return dungeonList.size(); } + void Dungeons::ParseJson(nlohmann::json spoilerFileJson) { nlohmann::json mqDungeonsJson = spoilerFileJson["masterQuestDungeons"]; - for (auto it = mqDungeonsJson.begin(); it != mqDungeonsJson.end(); ++it) { - std::string dungeonName = it.value().get(); - for (auto& dungeon : dungeonList) { - if (dungeon.GetName() == dungeonName) { - dungeon.SetMQ(); - } else { - dungeon.ClearMQ(); - } + + for (auto& dungeon : dungeonList) { + dungeon.ClearMQ(); + + if (std::find(mqDungeonsJson.begin(), mqDungeonsJson.end(), dungeon.GetName()) != mqDungeonsJson.end()) { + dungeon.SetMQ(); } } } -} // namespace Rando \ No newline at end of file +} // namespace Rando diff --git a/soh/soh/Enhancements/randomizer/trial.cpp b/soh/soh/Enhancements/randomizer/trial.cpp index 1110d37d8..a9b1f3fb3 100644 --- a/soh/soh/Enhancements/randomizer/trial.cpp +++ b/soh/soh/Enhancements/randomizer/trial.cpp @@ -71,13 +71,13 @@ size_t Trials::GetTrialListSize() const { void Trials::ParseJson(nlohmann::json spoilerFileJson) { nlohmann::json trialsJson = spoilerFileJson["requiredTrials"]; - for (auto it = trialsJson.begin(); it != trialsJson.end(); ++it) { - std::string trialName = it.value().get(); - for (auto& trial : mTrials) { - if (trial.GetName() == trialName) { + + for (auto& trial : mTrials) { + trial.SetAsSkipped(); + + for (auto nameInLang : trial.GetName().GetAllMessages()) { + if (std::find(trialsJson.begin(), trialsJson.end(), nameInLang) != trialsJson.end()) { trial.SetAsRequired(); - } else { - trial.SetAsSkipped(); } } } @@ -91,4 +91,4 @@ std::unordered_map Trials::GetAllTrialHintHeys( return output; } -} // namespace Rando \ No newline at end of file +} // namespace Rando