From 2925b20acb9f70d032cd5981687642a770778c53 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 22 Mar 2012 01:44:36 +0300 Subject: Rename object event to depricatedevent because current implimentation very bad and must be replaced with better implimentation. --- src/CMakeLists.txt | 4 +- src/Makefile.am | 4 +- src/client.cpp | 10 +-- src/depricatedevent.cpp | 141 +++++++++++++++++++++++++++++ src/depricatedevent.h | 171 ++++++++++++++++++++++++++++++++++++ src/event.cpp | 141 ----------------------------- src/event.h | 171 ------------------------------------ src/game.cpp | 30 ++++--- src/gui/chatwindow.cpp | 2 +- src/gui/chatwindow.h | 2 +- src/gui/inventorywindow.cpp | 2 +- src/gui/inventorywindow.h | 2 +- src/gui/killstats.cpp | 4 +- src/gui/killstats.h | 2 +- src/gui/ministatuswindow.cpp | 2 +- src/gui/ministatuswindow.h | 2 +- src/gui/statuswindow.cpp | 4 +- src/gui/statuswindow.h | 2 +- src/listener.cpp | 8 +- src/listener.h | 5 +- src/localplayer.cpp | 2 +- src/localplayer.h | 2 +- src/net/ea/buysellhandler.cpp | 2 +- src/net/ea/gamehandler.cpp | 4 +- src/net/ea/gamehandler.h | 2 +- src/net/ea/guildhandler.cpp | 2 +- src/net/ea/tradehandler.cpp | 2 +- src/net/manaserv/generalhandler.cpp | 2 +- src/net/manaserv/generalhandler.h | 2 +- src/net/manaserv/guildhandler.cpp | 2 +- src/net/manaserv/partyhandler.cpp | 2 +- src/net/manaserv/tradehandler.cpp | 2 +- src/net/tmwa/adminhandler.cpp | 2 +- src/net/tmwa/buysellhandler.cpp | 2 +- src/net/tmwa/chathandler.cpp | 2 +- src/net/tmwa/gamehandler.cpp | 2 +- src/net/tmwa/generalhandler.cpp | 2 +- src/net/tmwa/generalhandler.h | 2 +- src/playerinfo.cpp | 16 ++-- 39 files changed, 385 insertions(+), 378 deletions(-) create mode 100644 src/depricatedevent.cpp create mode 100644 src/depricatedevent.h delete mode 100644 src/event.cpp delete mode 100644 src/event.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7e7d60886..8653c2ef7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -520,13 +520,13 @@ SET(SRCS debug.h defaults.cpp defaults.h + depricatedevent.cpp + depricatedevent.h effectmanager.cpp effectmanager.h emoteshortcut.cpp emoteshortcut.h equipment.h - event.cpp - event.h flooritem.cpp flooritem.h game.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 06b457e4b..abb65f338 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -527,13 +527,13 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ debug.h \ defaults.cpp \ defaults.h \ + depricatedevent.cpp \ + depricatedevent.h \ effectmanager.cpp \ effectmanager.h \ emoteshortcut.cpp \ emoteshortcut.h \ equipment.h \ - event.cpp \ - event.h \ flooritem.cpp \ flooritem.h \ game.cpp \ diff --git a/src/client.cpp b/src/client.cpp index 4462c1a5d..62147874d 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -26,9 +26,9 @@ #include "auctionmanager.h" #include "chatlogger.h" #include "configuration.h" +#include "depricatedevent.h" #include "dropshortcut.h" #include "emoteshortcut.h" -#include "event.h" #include "game.h" #include "guild.h" #include "guildmanager.h" @@ -998,10 +998,10 @@ int Client::gameExec() if (mState != mOldState) { - Event evt(EVENT_STATECHANGE); + DepricatedEvent evt(EVENT_STATECHANGE); evt.setInt("oldState", mOldState); evt.setInt("newState", mState); - Event::trigger(CHANNEL_CLIENT, evt); + DepricatedEvent::trigger(CHANNEL_CLIENT, evt); if (mOldState == STATE_GAME) { @@ -1215,10 +1215,10 @@ int Client::gameExec() TranslationManager::loadCurrentLang(); - Event evt2(EVENT_STATECHANGE); + DepricatedEvent evt2(EVENT_STATECHANGE); evt2.setInt("newState", STATE_LOAD_DATA); evt2.setInt("oldState", mOldState); - Event::trigger(CHANNEL_CLIENT, evt2); + DepricatedEvent::trigger(CHANNEL_CLIENT, evt2); // Load XML databases CharDB::load(); diff --git a/src/depricatedevent.cpp b/src/depricatedevent.cpp new file mode 100644 index 000000000..965876fd1 --- /dev/null +++ b/src/depricatedevent.cpp @@ -0,0 +1,141 @@ +/* + * The ManaPlus Client + * Copyright (C) 2010 The Mana Developers + * Copyright (C) 2011-2012 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 "depricatedevent.h" + +#include "listener.h" +#include "variabledata.h" + +#include "debug.h" + +ListenMap DepricatedEvent::mBindings; + +DepricatedEvent::~DepricatedEvent() +{ + VariableMap::iterator it = mData.begin(); + while (it != mData.end()) + { + delete it->second; + it->second = nullptr; + ++it; + } +} + +void DepricatedEvent::setInt(const std::string &key, int value) throw (BadDepricatedEvent) +{ + if (mData.find(key) != mData.end()) + throw KEY_ALREADY_EXISTS; + + mData[key] = new IntData(value); +} + +int DepricatedEvent::getInt(const std::string &key) const throw (BadDepricatedEvent) +{ + VariableMap::const_iterator it = mData.find(key); + if (it == mData.end()) + throw BAD_KEY; + + if (!it->second || it->second->getType() != VariableData::DATA_INT) + throw BAD_VALUE; + + return static_cast(it->second)->getData(); +} + +void DepricatedEvent::setString(const std::string &key, + const std::string &value) throw (BadDepricatedEvent) +{ + if (mData.find(key) != mData.end()) + throw KEY_ALREADY_EXISTS; + + mData[key] = new StringData(value); +} + +const std::string &DepricatedEvent::getString(const std::string &key) + const throw (BadDepricatedEvent) +{ + VariableMap::const_iterator it = mData.find(key); + if (it == mData.end()) + throw BAD_KEY; + + if (!it->second || it->second->getType() != VariableData::DATA_STRING) + throw BAD_VALUE; + + return static_cast(it->second)->getData(); +} + + +void DepricatedEvent::setFloat(const std::string &key, double value) throw (BadDepricatedEvent) +{ + if (mData.find(key) != mData.end()) + throw KEY_ALREADY_EXISTS; + + mData[key] = new FloatData(value); +} + +double DepricatedEvent::getFloat(const std::string &key) const throw (BadDepricatedEvent) +{ + VariableMap::const_iterator it = mData.find(key); + if (it == mData.end()) + throw BAD_KEY; + + if (!it->second || it->second->getType() != VariableData::DATA_FLOAT) + throw BAD_VALUE; + + return static_cast(it->second)->getData(); +} + +void DepricatedEvent::trigger(Channels channel, const DepricatedEvent &event) +{ + ListenMap::const_iterator it = mBindings.find(channel); + + // Make sure something is listening + if (it == mBindings.end()) + return; + + // Loop though all listeners + ListenerSet::const_iterator lit = it->second.begin(); + while (lit != it->second.end()) + { + if (*lit) + (*lit)->processEvent(channel, event); + ++lit; + } +} + +void DepricatedEvent::remove(Listener *listener) +{ + ListenMap::iterator it = mBindings.begin(); + while (it != mBindings.end()) + { + it->second.erase(listener); + ++it; + } +} + +void DepricatedEvent::bind(Listener *listener, Channels channel) +{ + mBindings[channel].insert(listener); +} + +void DepricatedEvent::unbind(Listener *listener, Channels channel) +{ + mBindings[channel].erase(listener); +} diff --git a/src/depricatedevent.h b/src/depricatedevent.h new file mode 100644 index 000000000..a353b3de8 --- /dev/null +++ b/src/depricatedevent.h @@ -0,0 +1,171 @@ +/* + * The ManaPlus Client + * Copyright (C) 2010 The Mana Developers + * Copyright (C) 2011-2012 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 DEPRICATED_EVENT_H +#define DEPRICATED_EVENT_H + +#include +#include +#include + +enum Channels +{ + CHANNEL_ACTORSPRITE = 0, + CHANNEL_ATTRIBUTES, + CHANNEL_BUYSELL, + CHANNEL_CHAT, + CHANNEL_CLIENT, + CHANNEL_GAME, + CHANNEL_ITEM, + CHANNEL_NOTICES, + CHANNEL_NPC, + CHANNEL_STATUS, + CHANNEL_STORAGE +}; + +enum DepricatedEvents +{ + EVENT_ANNOUNCEMENT = 0, + EVENT_BEING, + EVENT_CLOSE, + EVENT_CLOSEALL, + EVENT_CONSTRUCTED, + EVENT_DBSLOADING, + EVENT_DESTROYED, + EVENT_DESTRUCTED, + EVENT_DESTRUCTING, + EVENT_DOCLOSE, + EVENT_DOCLOSEINVENTORY, + EVENT_DODROP, + EVENT_DOEQUIP, + EVENT_DOINTEGERINPUT, + EVENT_DOMENU, + EVENT_DOMOVE, + EVENT_DONEXT, + EVENT_DOSENDLETTER, + EVENT_DOSPLIT, + EVENT_DOSTRINGINPUT, + EVENT_DOTALK, + EVENT_DOUNEQUIP, + EVENT_DOUSE, + EVENT_END, + EVENT_ENGINESINITALIZED, + EVENT_ENGINESINITALIZING, + EVENT_GUIWINDOWSLOADED, + EVENT_GUIWINDOWSLOADING, + EVENT_GUIWINDOWSUNLOADED, + EVENT_GUIWINDOWSUNLOADING, + EVENT_INTEGERINPUT, + EVENT_MAPLOADED, + EVENT_MENU, + EVENT_MESSAGE, + EVENT_NEXT, + EVENT_NPCCOUNT, + EVENT_PLAYER, + EVENT_POST, + EVENT_POSTCOUNT, + EVENT_SERVERNOTICE, + EVENT_STATECHANGE, + EVENT_STORAGECOUNT, + EVENT_STRINGINPUT, + EVENT_STUN, + EVENT_TRADING, + EVENT_UPDATEATTRIBUTE, + EVENT_UPDATESTAT, + EVENT_UPDATESTATUSEFFECT, + EVENT_WHISPER, + EVENT_WHISPERERROR +}; + +// Possible exception that can be thrown +enum BadDepricatedEvent +{ + BAD_KEY = 0, + BAD_VALUE, + KEY_ALREADY_EXISTS +}; + +class Listener; +class VariableData; +typedef std::map VariableMap; + +typedef std::set ListenerSet; +typedef std::map ListenMap; + +#define SERVER_NOTICE(message) { \ +DepricatedEvent event(EVENT_SERVERNOTICE); \ +event.setString("message", message); \ +DepricatedEvent::trigger(CHANNEL_NOTICES, event); } + +class DepricatedEvent +{ + public: + // String passed can be retivered with getName() + // and is to used to identify what type of event + // this is. + DepricatedEvent(DepricatedEvents name) + { mDepricatedEventName = name; } + + ~DepricatedEvent(); + + DepricatedEvents getName() const + { return mDepricatedEventName; } + + // Sets or gets a interger with a key to identify + void setInt(const std::string &key, int value) + throw (BadDepricatedEvent); + + int getInt(const std::string &key) + const throw (BadDepricatedEvent); + + // Sets or gets a string with a key to identify + void setString(const std::string &key, + const std::string &value) + throw (BadDepricatedEvent); + + const std::string &getString(const std::string &key) + const throw (BadDepricatedEvent); + + // Sets or gets a floating point number with key to identify + void setFloat(const std::string &key, double value) + throw (BadDepricatedEvent); + double getFloat(const std::string &key) + const throw (BadDepricatedEvent); + + // Sends event to all listener on the channel + static void trigger(Channels channel, const DepricatedEvent &event); + + // Removes a listener from all channels + static void remove(Listener *listener); + + // Adds or removes a listener to a channel. + static void bind(Listener *listener, Channels channel); + static void unbind(Listener *listener, Channels channel); + + private: + DepricatedEvents mDepricatedEventName; + + static ListenMap mBindings; + + VariableMap mData; +}; + +#endif diff --git a/src/event.cpp b/src/event.cpp deleted file mode 100644 index a536bcaea..000000000 --- a/src/event.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2012 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 "event.h" - -#include "listener.h" -#include "variabledata.h" - -#include "debug.h" - -ListenMap Event::mBindings; - -Event::~Event() -{ - VariableMap::iterator it = mData.begin(); - while (it != mData.end()) - { - delete it->second; - it->second = nullptr; - ++it; - } -} - -void Event::setInt(const std::string &key, int value) throw (BadEvent) -{ - if (mData.find(key) != mData.end()) - throw KEY_ALREADY_EXISTS; - - mData[key] = new IntData(value); -} - -int Event::getInt(const std::string &key) const throw (BadEvent) -{ - VariableMap::const_iterator it = mData.find(key); - if (it == mData.end()) - throw BAD_KEY; - - if (!it->second || it->second->getType() != VariableData::DATA_INT) - throw BAD_VALUE; - - return static_cast(it->second)->getData(); -} - -void Event::setString(const std::string &key, - const std::string &value) throw (BadEvent) -{ - if (mData.find(key) != mData.end()) - throw KEY_ALREADY_EXISTS; - - mData[key] = new StringData(value); -} - -const std::string &Event::getString(const std::string &key) - const throw (BadEvent) -{ - VariableMap::const_iterator it = mData.find(key); - if (it == mData.end()) - throw BAD_KEY; - - if (!it->second || it->second->getType() != VariableData::DATA_STRING) - throw BAD_VALUE; - - return static_cast(it->second)->getData(); -} - - -void Event::setFloat(const std::string &key, double value) throw (BadEvent) -{ - if (mData.find(key) != mData.end()) - throw KEY_ALREADY_EXISTS; - - mData[key] = new FloatData(value); -} - -double Event::getFloat(const std::string &key) const throw (BadEvent) -{ - VariableMap::const_iterator it = mData.find(key); - if (it == mData.end()) - throw BAD_KEY; - - if (!it->second || it->second->getType() != VariableData::DATA_FLOAT) - throw BAD_VALUE; - - return static_cast(it->second)->getData(); -} - -void Event::trigger(Channels channel, const Event &event) -{ - ListenMap::const_iterator it = mBindings.find(channel); - - // Make sure something is listening - if (it == mBindings.end()) - return; - - // Loop though all listeners - ListenerSet::const_iterator lit = it->second.begin(); - while (lit != it->second.end()) - { - if (*lit) - (*lit)->processEvent(channel, event); - ++lit; - } -} - -void Event::remove(Listener *listener) -{ - ListenMap::iterator it = mBindings.begin(); - while (it != mBindings.end()) - { - it->second.erase(listener); - ++it; - } -} - -void Event::bind(Listener *listener, Channels channel) -{ - mBindings[channel].insert(listener); -} - -void Event::unbind(Listener *listener, Channels channel) -{ - mBindings[channel].erase(listener); -} diff --git a/src/event.h b/src/event.h deleted file mode 100644 index 7dffaad21..000000000 --- a/src/event.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2012 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 MANA_EVENT_H -#define MANA_EVENT_H - -#include -#include -#include - -enum Channels -{ - CHANNEL_ACTORSPRITE = 0, - CHANNEL_ATTRIBUTES, - CHANNEL_BUYSELL, - CHANNEL_CHAT, - CHANNEL_CLIENT, - CHANNEL_GAME, - CHANNEL_ITEM, - CHANNEL_NOTICES, - CHANNEL_NPC, - CHANNEL_STATUS, - CHANNEL_STORAGE -}; - -enum Events -{ - EVENT_ANNOUNCEMENT = 0, - EVENT_BEING, - EVENT_CLOSE, - EVENT_CLOSEALL, - EVENT_CONSTRUCTED, - EVENT_DBSLOADING, - EVENT_DESTROYED, - EVENT_DESTRUCTED, - EVENT_DESTRUCTING, - EVENT_DOCLOSE, - EVENT_DOCLOSEINVENTORY, - EVENT_DODROP, - EVENT_DOEQUIP, - EVENT_DOINTEGERINPUT, - EVENT_DOMENU, - EVENT_DOMOVE, - EVENT_DONEXT, - EVENT_DOSENDLETTER, - EVENT_DOSPLIT, - EVENT_DOSTRINGINPUT, - EVENT_DOTALK, - EVENT_DOUNEQUIP, - EVENT_DOUSE, - EVENT_END, - EVENT_ENGINESINITALIZED, - EVENT_ENGINESINITALIZING, - EVENT_GUIWINDOWSLOADED, - EVENT_GUIWINDOWSLOADING, - EVENT_GUIWINDOWSUNLOADED, - EVENT_GUIWINDOWSUNLOADING, - EVENT_INTEGERINPUT, - EVENT_MAPLOADED, - EVENT_MENU, - EVENT_MESSAGE, - EVENT_NEXT, - EVENT_NPCCOUNT, - EVENT_PLAYER, - EVENT_POST, - EVENT_POSTCOUNT, - EVENT_SERVERNOTICE, - EVENT_STATECHANGE, - EVENT_STORAGECOUNT, - EVENT_STRINGINPUT, - EVENT_STUN, - EVENT_TRADING, - EVENT_UPDATEATTRIBUTE, - EVENT_UPDATESTAT, - EVENT_UPDATESTATUSEFFECT, - EVENT_WHISPER, - EVENT_WHISPERERROR -}; - -// Possible exception that can be thrown -enum BadEvent -{ - BAD_KEY = 0, - BAD_VALUE, - KEY_ALREADY_EXISTS -}; - -class Listener; -class VariableData; -typedef std::map VariableMap; - -typedef std::set ListenerSet; -typedef std::map ListenMap; - -#define SERVER_NOTICE(message) { \ -Event event(EVENT_SERVERNOTICE); \ -event.setString("message", message); \ -Event::trigger(CHANNEL_NOTICES, event); } - -class Event -{ - public: - // String passed can be retivered with getName() - // and is to used to identify what type of event - // this is. - Event(Events name) - { mEventName = name; } - - ~Event(); - - Events getName() const - { return mEventName; } - - // Sets or gets a interger with a key to identify - void setInt(const std::string &key, int value) - throw (BadEvent); - - int getInt(const std::string &key) - const throw (BadEvent); - - // Sets or gets a string with a key to identify - void setString(const std::string &key, - const std::string &value) - throw (BadEvent); - - const std::string &getString(const std::string &key) - const throw (BadEvent); - - // Sets or gets a floating point number with key to identify - void setFloat(const std::string &key, double value) - throw (BadEvent); - double getFloat(const std::string &key) - const throw (BadEvent); - - // Sends event to all listener on the channel - static void trigger(Channels channel, const Event &event); - - // Removes a listener from all channels - static void remove(Listener *listener); - - // Adds or removes a listener to a channel. - static void bind(Listener *listener, Channels channel); - static void unbind(Listener *listener, Channels channel); - - private: - Events mEventName; - - static ListenMap mBindings; - - VariableMap mData; -}; - -#endif diff --git a/src/game.cpp b/src/game.cpp index 3aae1f60b..44ec0ea68 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -32,10 +32,10 @@ #include "client.h" #include "commandhandler.h" #include "configuration.h" +#include "depricatedevent.h" #include "dropshortcut.h" #include "effectmanager.h" #include "emoteshortcut.h" -#include "event.h" #include "guildmanager.h" #include "graphics.h" #include "itemshortcut.h" @@ -175,7 +175,8 @@ const unsigned adjustDelay = 10; */ static void initEngines() { - Event::trigger(CHANNEL_GAME, Event(EVENT_ENGINESINITALIZING)); + DepricatedEvent::trigger(CHANNEL_GAME, + DepricatedEvent(EVENT_ENGINESINITALIZING)); actorSpriteManager = new ActorSpriteManager; commandHandler = new CommandHandler; @@ -187,7 +188,8 @@ static void initEngines() particleEngine = new Particle(nullptr); particleEngine->setupEngine(); - Event::trigger(CHANNEL_GAME, Event(EVENT_ENGINESINITALIZED)); + DepricatedEvent::trigger(CHANNEL_GAME, + DepricatedEvent(EVENT_ENGINESINITALIZED)); } /** @@ -195,7 +197,8 @@ static void initEngines() */ static void createGuiWindows() { - Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSLOADING)); + DepricatedEvent::trigger(CHANNEL_GAME, + DepricatedEvent(EVENT_GUIWINDOWSLOADING)); if (setupWindow) setupWindow->clearWindowsForReset(); @@ -292,7 +295,8 @@ static void createGuiWindows() if (player_node) player_node->updateStatus(); - Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSLOADED)); + DepricatedEvent::trigger(CHANNEL_GAME, + DepricatedEvent(EVENT_GUIWINDOWSLOADED)); } #define del_0(X) { delete X; X = nullptr; } @@ -302,7 +306,8 @@ static void createGuiWindows() */ static void destroyGuiWindows() { - Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSUNLOADING)); + DepricatedEvent::trigger(CHANNEL_GAME, + DepricatedEvent(EVENT_GUIWINDOWSUNLOADING)); logger->setChatWindow(nullptr); if (whoIsOnline) @@ -345,7 +350,8 @@ static void destroyGuiWindows() del_0(killStats); del_0(didYouKnowWindow); - Event::trigger(CHANNEL_GAME, Event(EVENT_GUIWINDOWSUNLOADED)); + DepricatedEvent::trigger(CHANNEL_GAME, + DepricatedEvent(EVENT_GUIWINDOWSUNLOADED)); if (auctionManager && AuctionManager::getEnableAuctionBot()) auctionManager->reload(); @@ -416,7 +422,8 @@ Game::Game(): if (guildManager && GuildManager::getEnableGuildBot()) guildManager->requestGuildInfo(); - Event::trigger(CHANNEL_GAME, Event(EVENT_CONSTRUCTED)); + DepricatedEvent::trigger(CHANNEL_GAME, + DepricatedEvent(EVENT_CONSTRUCTED)); } Game::~Game() @@ -450,7 +457,8 @@ Game::~Game() mInstance = nullptr; - Event::trigger(CHANNEL_GAME, Event(EVENT_DESTRUCTED)); + DepricatedEvent::trigger(CHANNEL_GAME, + DepricatedEvent(EVENT_DESTRUCTED)); } static bool saveScreenshot() @@ -1846,9 +1854,9 @@ void Game::changeMap(const std::string &mapPath) if (mumbleManager) mumbleManager->setMap(mapPath); - Event event(EVENT_MAPLOADED); + DepricatedEvent event(EVENT_MAPLOADED); event.setString("mapPath", mapPath); - Event::trigger(CHANNEL_GAME, event); + DepricatedEvent::trigger(CHANNEL_GAME, event); } void Game::updateHistory(SDL_Event &event) diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index d651df87b..674c34039 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -869,7 +869,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) addInputText(Temp, false); } -void ChatWindow::processEvent(Channels channel, const Event &event) +void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event) { if (channel == CHANNEL_NOTICES) { diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index b3dce33fc..aa56237a2 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -190,7 +190,7 @@ class ChatWindow : public Window, */ void mousePressed(gcn::MouseEvent &event); - void processEvent(Channels channel, const Event &event); + void processEvent(Channels channel, const DepricatedEvent &event); /** * Scrolls the chat window diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 98d029be4..c3d5460ce 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -575,7 +575,7 @@ void InventoryWindow::close() } void InventoryWindow::processEvent(Channels channel A_UNUSED, - const Event &event) + const DepricatedEvent &event) { if (event.getName() == EVENT_UPDATEATTRIBUTE) { diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index a1ecd104c..47194b909 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -126,7 +126,7 @@ class InventoryWindow : public Window, void updateDropButton(); - void processEvent(Channels channel, const Event &event); + void processEvent(Channels channel, const DepricatedEvent &event); void updateButtons(Item *item = nullptr); diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index e563b8c7c..9fcc64ad3 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -32,7 +32,7 @@ #include "gui/chatwindow.h" #include "actorspritemanager.h" -#include "event.h" +#include "depricatedevent.h" #include "localplayer.h" #include "playerinfo.h" @@ -438,7 +438,7 @@ void KillStats::validateJacko() } void KillStats::processEvent(Channels channel A_UNUSED, - const Event &event) + const DepricatedEvent &event) { if (event.getName() == EVENT_UPDATEATTRIBUTE) { diff --git a/src/gui/killstats.h b/src/gui/killstats.h index 67c2967e3..e1528523d 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -78,7 +78,7 @@ class KillStats : public Window, gcn::ActionListener, public Listener void addLog(std::string str); void processEvent(Channels channel A_UNUSED, - const Event &event); + const DepricatedEvent &event); private: void validateJacko(); diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index aaccd36c8..219c319a5 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -219,7 +219,7 @@ void MiniStatusWindow::drawIcons(Graphics *graphics) } void MiniStatusWindow::processEvent(Channels channel A_UNUSED, - const Event &event) + const DepricatedEvent &event) { if (event.getName() == EVENT_UPDATEATTRIBUTE) { diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index eb6ded7dd..dfc945689 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -59,7 +59,7 @@ class MiniStatusWindow : public Popup, void drawIcons(Graphics *graphics); - void processEvent(Channels channel, const Event &event); + void processEvent(Channels channel, const DepricatedEvent &event); void updateStatus(); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 1964b974d..b1dade7d0 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -24,7 +24,7 @@ #include "chatwindow.h" #include "configuration.h" -#include "event.h" +#include "depricatedevent.h" #include "equipment.h" #include "inventory.h" #include "item.h" @@ -284,7 +284,7 @@ StatusWindow::StatusWindow(): } void StatusWindow::processEvent(Channels channel A_UNUSED, - const Event &event) + const DepricatedEvent &event) { static bool blocked = false; if (blocked) diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index 7f6bd2d18..c477a0099 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -52,7 +52,7 @@ class StatusWindow : public Window, */ StatusWindow(); - void processEvent(Channels channel, const Event &event); + void processEvent(Channels channel, const DepricatedEvent &event); void setPointsNeeded(int id, int needed); diff --git a/src/listener.cpp b/src/listener.cpp index fd04c9f00..0ad7c2603 100644 --- a/src/listener.cpp +++ b/src/listener.cpp @@ -21,21 +21,19 @@ #include "listener.h" -#include "event.h" - #include "debug.h" Listener::~Listener() { - Event::remove(this); + DepricatedEvent::remove(this); } void Listener::listen(Channels channel) { - Event::bind(this, channel); + DepricatedEvent::bind(this, channel); } void Listener::ignore(Channels channel) { - Event::unbind(this, channel); + DepricatedEvent::unbind(this, channel); } diff --git a/src/listener.h b/src/listener.h index bb6e3d4b4..d161f6ef5 100644 --- a/src/listener.h +++ b/src/listener.h @@ -22,7 +22,7 @@ #ifndef LISTENER_H #define LISTENER_H -#include "event.h" +#include "depricatedevent.h" #include @@ -35,7 +35,8 @@ class Listener void ignore(Channels channel); - virtual void processEvent(Channels channel, const Event &event) = 0; + virtual void processEvent(Channels channel, + const DepricatedEvent &event) = 0; }; #endif diff --git a/src/localplayer.cpp b/src/localplayer.cpp index f455cccb2..a57349a8a 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1655,7 +1655,7 @@ void LocalPlayer::optionChanged(const std::string &value) } void LocalPlayer::processEvent(Channels channel, - const Event &event) + const DepricatedEvent &event) { if (channel == CHANNEL_ATTRIBUTES) { diff --git a/src/localplayer.h b/src/localplayer.h index 03b3a2538..51d21178c 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -389,7 +389,7 @@ class LocalPlayer : public Being, public ActorSpriteListener, */ void optionChanged(const std::string &value); - void processEvent(Channels channel, const Event &event); + void processEvent(Channels channel, const DepricatedEvent &event); /** * set a following player. diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 73d4090b7..5208f34fc 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -24,7 +24,7 @@ #include "actorspritemanager.h" #include "configuration.h" -#include "event.h" +#include "depricatedevent.h" #include "inventory.h" #include "item.h" #include "localplayer.h" diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index c8c870dbd..71110984d 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -23,7 +23,7 @@ #include "net/ea/gamehandler.h" #include "client.h" -#include "event.h" +#include "depricatedevent.h" #include "game.h" #include "localplayer.h" #include "logger.h" @@ -47,7 +47,7 @@ GameHandler::GameHandler() } void GameHandler::processEvent(Channels channel, - const Event &event) + const DepricatedEvent &event) { if (channel == CHANNEL_GAME) { diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h index 59cb148c4..de7a1623d 100644 --- a/src/net/ea/gamehandler.h +++ b/src/net/ea/gamehandler.h @@ -38,7 +38,7 @@ class GameHandler : public Net::GameHandler, public Listener GameHandler(); virtual void processEvent(Channels channel, - const Event &event); + const DepricatedEvent &event); virtual void who(); diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index 950f26b03..88bf65d67 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -22,8 +22,8 @@ #include "net/ea/guildhandler.h" #include "actorspritemanager.h" +#include "depricatedevent.h" #include "guild.h" -#include "event.h" #include "localplayer.h" #include "logger.h" diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 0ba3925a8..80104ea67 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -22,7 +22,7 @@ #include "net/ea/tradehandler.h" -#include "event.h" +#include "depricatedevent.h" #include "inventory.h" #include "item.h" #include "logger.h" diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp index d95c98d23..241377956 100644 --- a/src/net/manaserv/generalhandler.cpp +++ b/src/net/manaserv/generalhandler.cpp @@ -177,7 +177,7 @@ void GeneralHandler::clearHandlers() } void GeneralHandler::processEvent(Channels channel, - const Event &event) + const DepricatedEvent &event) { if (channel == CHANNEL_CLIENT) { diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h index 6ea5c7845..2c5ef9263 100644 --- a/src/net/manaserv/generalhandler.h +++ b/src/net/manaserv/generalhandler.h @@ -50,7 +50,7 @@ class GeneralHandler : public Net::GeneralHandler, public Listener void clearHandlers(); - void processEvent(Channels channel, const Event &event); + void processEvent(Channels channel, const DepricatedEvent &event); protected: MessageHandlerPtr mBeingHandler; diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index aa82d6dcd..be8a9609a 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -22,7 +22,7 @@ #include "net/manaserv/guildhandler.h" -#include "event.h" +#include "depricatedevent.h" #include "guild.h" #include "logger.h" #include "localplayer.h" diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp index 60dcaaaff..34fb2e954 100644 --- a/src/net/manaserv/partyhandler.cpp +++ b/src/net/manaserv/partyhandler.cpp @@ -22,7 +22,7 @@ #include "net/manaserv/partyhandler.h" -#include "event.h" +#include "depricatedevent.h" #include "logger.h" #include "localplayer.h" diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp index e827c2cec..72dbf9a9d 100644 --- a/src/net/manaserv/tradehandler.cpp +++ b/src/net/manaserv/tradehandler.cpp @@ -23,7 +23,7 @@ #include "net/manaserv/tradehandler.h" #include "actorspritemanager.h" -#include "event.h" +#include "depricatedevent.h" #include "item.h" #include "localplayer.h" #include "playerinfo.h" diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 65f4d6f2c..acf869f25 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -26,7 +26,7 @@ #include "actorspritemanager.h" #include "being.h" -#include "event.h" +#include "depricatedevent.h" #include "game.h" #include "logger.h" #include "playerrelations.h" diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 629aa54f6..c3e489350 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -24,7 +24,7 @@ #include "actorspritemanager.h" #include "configuration.h" -#include "event.h" +#include "depricatedevent.h" #include "inventory.h" #include "item.h" #include "localplayer.h" diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 368421285..7830d3a81 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -25,7 +25,7 @@ #include "actorspritemanager.h" #include "being.h" #include "configuration.h" -#include "event.h" +#include "depricatedevent.h" #include "game.h" #include "localplayer.h" #include "playerrelations.h" diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 2496898d1..12bfe24cf 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -23,7 +23,7 @@ #include "net/tmwa/gamehandler.h" #include "client.h" -#include "event.h" +#include "depricatedevent.h" #include "game.h" #include "localplayer.h" #include "logger.h" diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 77c91e1dd..8f2f25d6d 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -245,7 +245,7 @@ void GeneralHandler::clearHandlers() } void GeneralHandler::processEvent(Channels channel, - const Event &event) + const DepricatedEvent &event) { if (channel == CHANNEL_GAME) { diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index 73f7a0e1b..f938ddd1d 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -53,7 +53,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler, void clearHandlers(); - void processEvent(Channels channel, const Event &event); + void processEvent(Channels channel, const DepricatedEvent &event); void reloadPartially(); diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 6dd7bdc06..533ed8576 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -22,8 +22,8 @@ #include "playerinfo.h" #include "client.h" +#include "depricatedevent.h" #include "equipment.h" -#include "event.h" #include "inventory.h" #include "listener.h" #include "logger.h" @@ -59,11 +59,11 @@ int mLevelProgress = 0; void triggerAttr(int id, int old) { - Event event(EVENT_UPDATEATTRIBUTE); + DepricatedEvent event(EVENT_UPDATEATTRIBUTE); event.setInt("id", id); event.setInt("oldValue", old); event.setInt("newValue", mData.mAttributes.find(id)->second); - Event::trigger(CHANNEL_ATTRIBUTES, event); + DepricatedEvent::trigger(CHANNEL_ATTRIBUTES, event); } void triggerStat(int id, const std::string &changed, int old1, int old2) @@ -72,7 +72,7 @@ void triggerStat(int id, const std::string &changed, int old1, int old2) if (it == mData.mStats.end()) return; - Event event(EVENT_UPDATESTAT); + DepricatedEvent event(EVENT_UPDATESTAT); event.setInt("id", id); event.setInt("base", it->second.base); event.setInt("mod", it->second.mod); @@ -81,7 +81,7 @@ void triggerStat(int id, const std::string &changed, int old1, int old2) event.setString("changed", changed); event.setInt("oldValue1", old1); event.setInt("oldValue2", old2); - Event::trigger(CHANNEL_ATTRIBUTES, event); + DepricatedEvent::trigger(CHANNEL_ATTRIBUTES, event); } // --- Attributes ------------------------------------------------------------- @@ -280,9 +280,9 @@ void setTrading(bool trading) if (notify) { - Event event(EVENT_TRADING); + DepricatedEvent event(EVENT_TRADING); event.setInt("trading", trading); - Event::trigger(CHANNEL_STATUS, event); + DepricatedEvent::trigger(CHANNEL_STATUS, event); } } @@ -312,7 +312,7 @@ public: listen(CHANNEL_GAME); } - void processEvent(Channels channel, const Event &event) + void processEvent(Channels channel, const DepricatedEvent &event) { if (channel == CHANNEL_CLIENT) { -- cgit v1.2.3-60-g2f50