diff options
Diffstat (limited to 'crawl-ref/source/libutil.h')
-rw-r--r-- | crawl-ref/source/libutil.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h index 6b31b93728..0f232baa72 100644 --- a/crawl-ref/source/libutil.h +++ b/crawl-ref/source/libutil.h @@ -125,6 +125,23 @@ enum KEYS CK_CTRL_PGDN }; +// Sets a boolean to a new value in the scope of the object instance. +class unwind_bool +{ +public: + unwind_bool(bool &val_, bool newval) : val(val_), oldval(val_) + { + val = newval; + } + ~unwind_bool() + { + val = oldval; + } +private: + bool &val; + bool oldval; +}; + class cursor_control { public: |