1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 22:39:53 +00:00

rogueviz:: added the missing function on_cleanup_or_next

This commit is contained in:
Zeno Rogue 2021-10-17 17:02:34 +02:00
parent 1e504d98ae
commit 4040f56262

View File

@ -109,13 +109,17 @@ namespace rogueviz {
void do_cleanup(); void do_cleanup();
inline void on_cleanup_or_next(const reaction_t& del) {
if(tour::on) tour::on_restore(del);
else cleanup.push_back(del);
}
template<class T, class U> void rv_hook(hookset<T>& m, int prio, U&& hook) { template<class T, class U> void rv_hook(hookset<T>& m, int prio, U&& hook) {
int p = addHook(m, prio, hook); int p = addHook(m, prio, hook);
auto del = [&m, p] { auto del = [&m, p] {
delHook(m, p); delHook(m, p);
}; };
if(tour::on) tour::on_restore(del); on_cleanup_or_next(del);
else cleanup.push_back(del);
} }
namespace anygraph { namespace anygraph {