From e3009cfe9cc0a824450d3e71a0ce8d6b5cd9ff91 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 19 Apr 2015 22:02:33 +0300 Subject: Add quick settings page for yellow bar options. --- src/listeners/awaylistener.cpp | 2 +- src/listeners/gamemodifierlistener.cpp | 36 ++++++++++++++++++++++++++++++++ src/listeners/gamemodifierlistener.h | 38 ++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 src/listeners/gamemodifierlistener.cpp create mode 100644 src/listeners/gamemodifierlistener.h (limited to 'src/listeners') diff --git a/src/listeners/awaylistener.cpp b/src/listeners/awaylistener.cpp index 6a8057888..b8b89402f 100644 --- a/src/listeners/awaylistener.cpp +++ b/src/listeners/awaylistener.cpp @@ -37,7 +37,7 @@ void AwayListener::action(const ActionEvent &event) { if (event.getId() == "ok" && localPlayer && settings.awayMode) { - GameModifiers::changeAwayMode(); + GameModifiers::changeAwayMode(true); localPlayer->updateStatus(); if (outfitWindow) outfitWindow->unwearAwayOutfit(); diff --git a/src/listeners/gamemodifierlistener.cpp b/src/listeners/gamemodifierlistener.cpp new file mode 100644 index 000000000..a8f28a2f6 --- /dev/null +++ b/src/listeners/gamemodifierlistener.cpp @@ -0,0 +1,36 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014-2015 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/gamemodifierlistener.h" + +#include "debug.h" + +defineListener(GameModifierListener) + +void GameModifierListener::distributeEvent() +{ + FOR_EACH (std::vector::iterator, + it, mListeners) + { + GameModifierListener *const listener = *it; + if (listener) + listener->gameModifiersChanged(); + } +} diff --git a/src/listeners/gamemodifierlistener.h b/src/listeners/gamemodifierlistener.h new file mode 100644 index 000000000..0d3966130 --- /dev/null +++ b/src/listeners/gamemodifierlistener.h @@ -0,0 +1,38 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014-2015 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_GAMEMODIFIERLISTENER_H +#define LISTENERS_GAMEMODIFIERLISTENER_H + +#include "listeners/baselistener.hpp" + +#include "localconsts.h" + +class GameModifierListener notfinal +{ + public: + virtual void gameModifiersChanged() = 0; + + static void distributeEvent(); + + defineListenerHeader(GameModifierListener) +}; + +#endif // LISTENERS_GAMEMODIFIERLISTENER_H -- cgit v1.2.3-60-g2f50