diff options
author | 2018-10-19 00:35:32 +0200 | |
---|---|---|
committer | 2018-10-19 00:35:32 +0200 | |
commit | efe1757a858f03fff73e110626e85af8d2ed7d03 (patch) | |
tree | 5433f1344a7120f3d90f9480e79c65ca850b7564 /src/lib/util/options.cpp | |
parent | cdb4ae2fab56a624bf8e2ea59f19a57f11ff1109 (diff) | |
parent | f1b3e649fb0a50a6a01da667278b8a62fef99d92 (diff) |
Merge branch 'master' of https://github.com/mamedev/mame
Diffstat (limited to 'src/lib/util/options.cpp')
-rw-r--r-- | src/lib/util/options.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp index d323ef11ffe..cffb7493fe3 100644 --- a/src/lib/util/options.cpp +++ b/src/lib/util/options.cpp @@ -1025,3 +1025,30 @@ 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) + if (curentry->type() != option_type::HEADER) + 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); + } +} |