1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-25 22:53:19 +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();
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) {
int p = addHook(m, prio, hook);
auto del = [&m, p] {
delHook(m, p);
};
if(tour::on) tour::on_restore(del);
else cleanup.push_back(del);
on_cleanup_or_next(del);
}
namespace anygraph {