diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-04-27 19:03:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-04-27 19:03:49 +0300 |
commit | c77f06f7b80a67c842abe837beb2f22e9ecf60cc (patch) | |
tree | 65da775f4830fde8ccbf7a6d7514e42169321486 /src/listeners | |
parent | 8836d01c806f7d7e99befb5036148e8ff7b0e24e (diff) | |
download | mv-c77f06f7b80a67c842abe837beb2f22e9ecf60cc.tar.gz mv-c77f06f7b80a67c842abe837beb2f22e9ecf60cc.tar.bz2 mv-c77f06f7b80a67c842abe837beb2f22e9ecf60cc.tar.xz mv-c77f06f7b80a67c842abe837beb2f22e9ecf60cc.zip |
Add ArrowsListener.
Also fix arrows amount update on arrows pickup.
Diffstat (limited to 'src/listeners')
-rw-r--r-- | src/listeners/arrowslistener.cpp | 36 | ||||
-rw-r--r-- | src/listeners/arrowslistener.h | 38 |
2 files changed, 74 insertions, 0 deletions
diff --git a/src/listeners/arrowslistener.cpp b/src/listeners/arrowslistener.cpp new file mode 100644 index 000000000..d9d7b0006 --- /dev/null +++ b/src/listeners/arrowslistener.cpp @@ -0,0 +1,36 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "listeners/arrowslistener.h" + +#include "debug.h" + +defineListener(ArrowsListener) + +void ArrowsListener::distributeEvent() +{ + FOR_EACH (std::vector<ArrowsListener*>::iterator, + it, mListeners) + { + ArrowsListener *const listener = *it; + if (listener) + listener->arrowsChanged(); + } +} diff --git a/src/listeners/arrowslistener.h b/src/listeners/arrowslistener.h new file mode 100644 index 000000000..92811331b --- /dev/null +++ b/src/listeners/arrowslistener.h @@ -0,0 +1,38 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef LISTENERS_ARROWSLISTENER_H +#define LISTENERS_ARROWSLISTENER_H + +#include "listeners/baselistener.hpp" + +#include "localconsts.h" + +class ArrowsListener +{ + public: + virtual void arrowsChanged() = 0; + + static void distributeEvent(); + + defineListenerHeader(ArrowsListener) +}; + +#endif // LISTENERS_ARROWSLISTENER_H |