diff options
author | 2018-10-05 01:13:05 +0200 | |
---|---|---|
committer | 2018-10-05 01:20:04 +0200 | |
commit | f522870d8acf3e12ab0845272844561d9195fe4d (patch) | |
tree | 46ebc8a6926af06ce89bd9308537a8eeb2fdf610 /src/lib/util/options.cpp | |
parent | 99574efebe6c62ac7b4fda4080174dd91ac821ff (diff) |
-options: Restored erroneously-removed game-specific INI option reversion between runs. Fixes MT#06171. [Ryan Holtz]
Diffstat (limited to 'src/lib/util/options.cpp')
-rw-r--r-- | src/lib/util/options.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp index d323ef11ffe..a7e901bbf70 100644 --- a/src/lib/util/options.cpp +++ b/src/lib/util/options.cpp @@ -1025,3 +1025,29 @@ bool core_options::header_exists(const char *description) const return iter != m_entries.end(); } + +//------------------------------------------------- +// revert - revert options at or below a certain +// priority back to their defaults +//------------------------------------------------- + +void core_options::revert(int priority_hi, int priority_lo) +{ + for (entry::shared_ptr &curentry : m_entries) + curentry->revert(priority_hi, priority_lo); +} + +//------------------------------------------------- +// revert - revert back to our default if we are +// within the given priority range +//------------------------------------------------- + +void core_options::simple_entry::revert(int priority_hi, int priority_lo) +{ + // if our priority is within the range, revert to the default + if (priority() <= priority_hi && priority() >= priority_lo) + { + set_value(std::string(default_value()), priority(), true); + set_priority(OPTION_PRIORITY_DEFAULT); + } +} |