1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-13 17:06:52 +00:00

hook deletion

This commit is contained in:
Zeno Rogue 2020-09-11 11:17:12 +02:00
parent acc9b40431
commit db646aba5d

10
hyper.h
View File

@ -458,7 +458,11 @@ public:
prio++;
}
map_->emplace(prio, static_cast<U&&>(hook));
return 0;
return prio;
}
void del(int prio) {
map_->erase(prio);
}
template<class... U>
@ -709,6 +713,10 @@ template<class T, class U> int addHook(hookset<T>& m, int prio, U&& hook) {
return m.add(prio, static_cast<U&&>(hook));
}
template<class T> void delHook(hookset<T>& m, int prio) {
m.del(prio);
}
template<class T, class... U> void callhooks(const hookset<T>& h, U&&... args) {
return h.callhooks(static_cast<U&&>(args)...);
}