From c77f06f7b80a67c842abe837beb2f22e9ecf60cc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 27 Apr 2014 19:03:49 +0300 Subject: Add ArrowsListener. Also fix arrows amount update on arrows pickup. --- src/listeners/arrowslistener.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/listeners/arrowslistener.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/listeners/arrowslistener.cpp create mode 100644 src/listeners/arrowslistener.h (limited to 'src/listeners') 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 . + */ + +#include "listeners/arrowslistener.h" + +#include "debug.h" + +defineListener(ArrowsListener) + +void ArrowsListener::distributeEvent() +{ + FOR_EACH (std::vector::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 . + */ + +#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 -- cgit v1.2.3-70-g09d2