mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-01 03:39:16 +00:00
hook deletion
This commit is contained in:
parent
acc9b40431
commit
db646aba5d
10
hyper.h
10
hyper.h
@ -458,9 +458,13 @@ public:
|
||||
prio++;
|
||||
}
|
||||
map_->emplace(prio, static_cast<U&&>(hook));
|
||||
return 0;
|
||||
return prio;
|
||||
}
|
||||
|
||||
void del(int prio) {
|
||||
map_->erase(prio);
|
||||
}
|
||||
|
||||
template<class... U>
|
||||
void callhooks(U&&... args) const {
|
||||
if (map_ == nullptr) return;
|
||||
@ -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)...);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user