diff --git a/input/dispatcher.hpp b/input/dispatcher.hpp index 930195856a..dd6fb6bf6d 100644 --- a/input/dispatcher.hpp +++ b/input/dispatcher.hpp @@ -4,6 +4,7 @@ #include "dispatch_map.hpp" #include "func_binder.hpp" #include +#include namespace OEngine { namespace Input { @@ -19,8 +20,16 @@ struct Dispatcher : Mangle::Input::Event */ Dispatcher(int actions) : funcs(actions) {} - void bind(int action, int key) { map.bind(key, action); } - void unbind(int action, int key) { map.unbind(key, action); } + void bind(unsigned int action, int key) + { + assert(action < funcs.getSize()); + map.bind(key, action); + } + void unbind(unsigned int action, int key) + { + assert(action < funcs.getSize()); + map.unbind(key, action); + } bool isBound(int key) const { return map.isBound(key); } /** diff --git a/input/func_binder.hpp b/input/func_binder.hpp index d2bfd53e5b..7aa733edf8 100644 --- a/input/func_binder.hpp +++ b/input/func_binder.hpp @@ -50,6 +50,8 @@ public: */ FuncBinder(int number) : bindings(number) {} + unsigned int getSize() { return bindings.size(); } + /** Bind an action to an index. */