diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-07-18 12:11:39 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-07-18 12:25:37 -0600 |
commit | 060b5d24f824de45342c8ea1bab8fc98c08b369d (patch) | |
tree | 57b304d388277310990775ee5c9bb0f67b7bb7e6 /src/game.cpp | |
parent | 81d8168bb5796ccb1704bcce9f5327c35e55d281 (diff) | |
download | mana-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.gz mana-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.bz2 mana-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.xz mana-060b5d24f824de45342c8ea1bab8fc98c08b369d.zip |
Replace some state-related netcode methods with events
Also move the virtual destructors of the Net handler base classes to
the top of their method lists.
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp index 4d101fd5..955de326 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -130,6 +130,8 @@ ChatTab *localChatTab = NULL; */ static void initEngines() { + Mana::EventManager::trigger("Game", Mana::Event("EnginesInitalizing")); + actorSpriteManager = new ActorSpriteManager; commandHandler = new CommandHandler; channelManager = new ChannelManager; @@ -137,6 +139,8 @@ static void initEngines() particleEngine = new Particle(NULL); particleEngine->setupEngine(); + + Mana::EventManager::trigger("Game", Mana::Event("EnginesInitalized")); } /** @@ -144,6 +148,8 @@ static void initEngines() */ static void createGuiWindows() { + Mana::EventManager::trigger("Game", Mana::Event("GuiWindowsLoading")); + setupWindow->clearWindowsForReset(); // Create dialogs @@ -172,7 +178,7 @@ static void createGuiWindows() logger->setChatWindow(chatWindow); } - Net::getGeneralHandler()->guiWindowsLoaded(); + Mana::EventManager::trigger("Game", Mana::Event("GuiWindowsLoaded")); } #define del_0(X) { delete X; X = 0; } @@ -182,7 +188,8 @@ static void createGuiWindows() */ static void destroyGuiWindows() { - Net::getGeneralHandler()->guiWindowsUnloaded(); + Mana::EventManager::trigger("Game", Mana::Event("GuiWindowsUnloading")); + logger->setChatWindow(NULL); del_0(localChatTab) // Need to do this first, so it can remove itself del_0(chatWindow) @@ -200,6 +207,8 @@ static void destroyGuiWindows() del_0(outfitWindow) del_0(specialsWindow) del_0(socialWindow) + + Mana::EventManager::trigger("Game", Mana::Event("GuiWindowsUnloaded")); } Game *Game::mInstance = 0; @@ -229,8 +238,6 @@ Game::Game(): initEngines(); - Net::getGameHandler()->inGame(); - // Initialize beings actorSpriteManager->setPlayer(player_node); @@ -253,8 +260,7 @@ Game::Game(): setupWindow->setInGame(true); - Mana::Event event("Constructed"); - Mana::EventManager::trigger("Game", event); + Mana::EventManager::trigger("Game", Mana::Event("Constructed")); } Game::~Game() @@ -275,8 +281,7 @@ Game::~Game() mInstance = 0; - Mana::Event event("Destructed"); - Mana::EventManager::trigger("Game", event); + Mana::EventManager::trigger("Game", Mana::Event("Destructed")); } static bool saveScreenshot() @@ -966,5 +971,7 @@ void Game::changeMap(const std::string &mapPath) delete mCurrentMap; mCurrentMap = newMap; - Net::getGameHandler()->mapLoaded(mapPath); + Mana::Event event("MapLoaded"); + event.setString("mapPath", mapPath); + Mana::EventManager::trigger("Game", event); } |