Skip to content

Commit

Permalink
Fixed save data keys not being checked correctly before usage
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaghettDev committed Mar 3, 2024
1 parent 9c027ce commit 28a775c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.0.1] - 2024-03-03

### Fixed

- `RouletteManager` not getting new keys because it just assumed they existed prior

## [2.0.0] - 2024-03-01

GD-Roulette commit everything at once challenge (mildly possible)
Expand Down
20 changes: 10 additions & 10 deletions src/roulette/manager/RouletteManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,31 @@ struct RouletteManager

if (!Mod::get()->hasSavedValue("difficulty-array"))
Mod::get()->setSavedValue<std::vector<bool>>("difficulty-array", { true, false, false, false, false, false });

{
auto& arr = getFromSaveContainer("difficulty-array").as_array();

previousDifficulty = getDifficultyFromSaveContainer("difficulty-array");
previousDemonDifficulty = getDifficultyFromSaveContainer("demon-difficulty-array");
verifyArray("difficulty-array", arr);
}
else
verifyArray("difficulty-array", getFromSaveContainer("difficulty-array").as_array());


if (!Mod::get()->hasSavedValue("demon-difficulty-array"))
Mod::get()->setSavedValue<std::vector<bool>>("demon-difficulty-array", { true, false, false, false, false });
verifyArray("demon-difficulty-array", saveContainer["demon-difficulty-array"].as_array());
else
verifyArray("demon-difficulty-array", saveContainer["demon-difficulty-array"].as_array());


if (!Mod::get()->hasSavedValue("selected-list-array"))
Mod::get()->setSavedValue<std::vector<bool>>("selected-list-array", { true, false, false, false });
verifyArray("selected-list-array", saveContainer["selected-list-array"].as_array());
else
verifyArray("selected-list-array", saveContainer["selected-list-array"].as_array());


if (!Mod::get()->hasSavedValue("gdListID"))
Mod::get()->setSavedValue<uint64_t>("gdListID", static_cast<uint64_t>(gdListID));
else
gdListID = static_cast<int>(Mod::get()->getSavedValue<uint64_t>("gdListID"));


previousDifficulty = getDifficultyFromSaveContainer("difficulty-array");
previousDemonDifficulty = getDifficultyFromSaveContainer("demon-difficulty-array");

m_hasInitManager = true;
}
}
Expand Down

0 comments on commit 28a775c

Please sign in to comment.