From a6f6dc9c2db87ed852cac1f8a3047f9b1d3efac0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 27 Apr 2014 16:24:12 +0300 Subject: Add StatListener. --- src/listeners/statlistener.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/listeners/statlistener.cpp (limited to 'src/listeners/statlistener.cpp') diff --git a/src/listeners/statlistener.cpp b/src/listeners/statlistener.cpp new file mode 100644 index 000000000..420eb90db --- /dev/null +++ b/src/listeners/statlistener.cpp @@ -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 . + */ + +#include "listeners/statlistener.h" + +#include "debug.h" + +defineListener(StatListener) + +void StatListener::distributeEvent(const int id, + const int oldVal1, + const int oldVal2) +{ + FOR_EACH (std::vector::iterator, + it, mListeners) + { + StatListener *const listener = *it; + if (listener) + listener->statChanged(id, oldVal1, oldVal2); + } +} -- cgit v1.2.3-60-g2f50