clean up/fix mq dungeon and required trial parsing logic (#4979)
This commit is contained in:
@@ -1419,17 +1419,16 @@ std::array<DungeonInfo*, 12> 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<std::string>();
|
||||
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
|
||||
} // namespace Rando
|
||||
|
||||
@@ -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<std::string>();
|
||||
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<uint32_t, RandomizerHintTextKey> Trials::GetAllTrialHintHeys(
|
||||
return output;
|
||||
}
|
||||
|
||||
} // namespace Rando
|
||||
} // namespace Rando
|
||||
|
||||
Reference in New Issue
Block a user