Added sanity check to clearing sectionBlock["data"] to only be for randomizer and only when the save file is not randomizer (to clear the existing structure from the loaded spoiler log).

This commit is contained in:
Malkierian 2023-05-13 11:45:20 -07:00
parent 550c10b1c3
commit e2177d7392

View File

@ -723,7 +723,9 @@ void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext, const
if (std::find(gameSaveRegistry.begin(), gameSaveRegistry.end(), sectionHandler.first) != gameSaveRegistry.end()) { if (std::find(gameSaveRegistry.begin(), gameSaveRegistry.end(), sectionHandler.first) != gameSaveRegistry.end()) {
nlohmann::json& sectionBlock = saveBlock["sections"][sectionHandler.first]; nlohmann::json& sectionBlock = saveBlock["sections"][sectionHandler.first];
sectionBlock["version"] = sectionHandler.second.first; sectionBlock["version"] = sectionHandler.second.first;
if (sectionHandler.first == "randomizer" && !gSaveContext.n64ddFlag) {
sectionBlock["data"] = nlohmann::json::object(); sectionBlock["data"] = nlohmann::json::object();
}
currentJsonContext = &sectionBlock["data"]; currentJsonContext = &sectionBlock["data"];
sectionHandler.second.second(saveContext, "all"); sectionHandler.second.second(saveContext, "all");