mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-19 06:27:02 -04:00
add button to reset settings to default
This commit is contained in:
@@ -16,6 +16,17 @@ namespace randomizer::seedgen::config
|
||||
LoadFromFile(settingsPath, preferencesPath);
|
||||
}
|
||||
|
||||
void Config::ResetSettingsToDefault() {
|
||||
for (auto& settings : this->_settingsList) {
|
||||
for (auto& [settingName, setting] : settings.GetMap()) {
|
||||
setting.SetCurrentOption(setting.GetInfo()->GetDefaultOption());
|
||||
}
|
||||
settings.GetModifiableExcludedLocations().clear();
|
||||
settings.GetModifiableStartingInventory().clear();
|
||||
settings.GetModifiableMixedEntrancePools().clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Config::LoadFromFile(const fspath& settingsPath,
|
||||
const fspath& preferencesPath,
|
||||
const bool& createIfNotFound /*= true*/,
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace randomizer::seedgen::config
|
||||
auto& GetSettings() { return this->_settingsList.front();}
|
||||
bool IsUsingPlandomizer() const { return this->_isUsingPlandomizer; }
|
||||
bool IsGeneratingSpoilerLog() const { return this->_isGeneratingSpoilerLog; }
|
||||
void ResetSettingsToDefault();
|
||||
|
||||
// void resetDefaultSettings();
|
||||
// void resetDefaultPreferences(const bool& paths = false);
|
||||
|
||||
@@ -202,6 +202,7 @@ namespace randomizer::seedgen::settings
|
||||
const std::list<std::list<std::string>>& GetMixedEntrancePools() const { return this->_mixedEntrancePools; }
|
||||
std::map<std::string, int>& GetModifiableStartingInventory() { return this->_startingInventory; }
|
||||
std::set<std::string>& GetModifiableExcludedLocations() { return this->_excludedLocations; }
|
||||
std::list<std::list<std::string>>& GetModifiableMixedEntrancePools() { return this->_mixedEntrancePools; }
|
||||
|
||||
private:
|
||||
std::map<std::string, Setting> _map = {};
|
||||
|
||||
@@ -829,6 +829,17 @@ RandomizerWindow::RandomizerWindow(dFile_select_c* fileSelect /*= nullptr*/) : m
|
||||
auto& leftPane = add_child<Pane>(content, Pane::Type::Controlled);
|
||||
auto& rightPane = add_child<Pane>(content, Pane::Type::Uncontrolled);
|
||||
|
||||
leftPane.register_control(leftPane.add_button("Reset Settings to Default")
|
||||
.on_pressed([] {
|
||||
GetRandomizerConfig().ResetSettingsToDefault();
|
||||
SaveRandomizerConfig();
|
||||
}),
|
||||
rightPane, [](Pane& pane) {
|
||||
pane.clear();
|
||||
pane.add_rml(
|
||||
"Reset all settings to their default values. This will also clear starting items and excluded locations.");
|
||||
});
|
||||
|
||||
leftPane.add_section("Logic Settings");
|
||||
|
||||
rando_config_group(leftPane, rightPane, "Logic Rules");
|
||||
|
||||
Reference in New Issue
Block a user