Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Event.hpp"
- void Event::doEvent() {
- for (int i = 0; i < handlers.size(); i++) {
- handlers.at(i)->handle(this);
- }
- if (!cancelled) {
- execute();
- }
- }
- bool Event::setCancelled(bool cancelled) {
- bool cancellable = isCancellable();
- if (cancellable) {
- this->cancelled = cancelled;
- }
- return cancellable;
- }
- std::vector<std::shared_ptr<EventHandler>> Event::handlers;
- void Event::addHandler(std::shared_ptr<EventHandler> handler) {
- if (handlers.size() == 0) {
- handlers.reserve(20);
- }
- handlers.emplace_back(handler);
- }
Add Comment
Please, Sign In to add comment