summaryrefslogtreecommitdiff
path: root/src/net/tmwa/generalhandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-07-18 12:11:39 -0600
committerJared Adams <jaxad0127@gmail.com>2010-07-18 12:25:37 -0600
commit060b5d24f824de45342c8ea1bab8fc98c08b369d (patch)
tree57b304d388277310990775ee5c9bb0f67b7bb7e6 /src/net/tmwa/generalhandler.cpp
parent81d8168bb5796ccb1704bcce9f5327c35e55d281 (diff)
downloadmana-client-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.gz
mana-client-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.bz2
mana-client-060b5d24f824de45342c8ea1bab8fc98c08b369d.tar.xz
mana-client-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/net/tmwa/generalhandler.cpp')
-rw-r--r--src/net/tmwa/generalhandler.cpp81
1 files changed, 43 insertions, 38 deletions
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 14f48055..ba9b329e 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -23,6 +23,7 @@
#include "client.h"
#include "configuration.h"
+#include "event.h"
#include "log.h"
#include "gui/charselectdialog.h"
@@ -32,6 +33,10 @@
#include "gui/socialwindow.h"
#include "gui/statuswindow.h"
+#include "net/messagein.h"
+#include "net/messageout.h"
+#include "net/serverinfo.h"
+
#include "net/tmwa/adminhandler.h"
#include "net/tmwa/beinghandler.h"
#include "net/tmwa/buysellhandler.h"
@@ -53,9 +58,6 @@
#include "net/tmwa/gui/guildtab.h"
#include "net/tmwa/gui/partytab.h"
-#include "net/messagein.h"
-#include "net/messageout.h"
-
#include "resources/itemdb.h"
#include "utils/gettext.h"
@@ -106,6 +108,8 @@ GeneralHandler::GeneralHandler():
stats.push_back(ItemDB::Stat("luck", _("Luck %+d")));
ItemDB::setStatsList(stats);
+
+ listen("Game");
}
GeneralHandler::~GeneralHandler()
@@ -209,47 +213,48 @@ void GeneralHandler::flushNetwork()
}
}
-void GeneralHandler::guiWindowsLoaded()
-{
- inventoryWindow->setSplitAllowed(false);
- skillDialog->loadSkills("ea-skills.xml");
-
- statusWindow->addAttribute(STR, _("Strength"), true, "");
- statusWindow->addAttribute(AGI, _("Agility"), true, "");
- statusWindow->addAttribute(VIT, _("Vitality"), true, "");
- statusWindow->addAttribute(INT, _("Intelligence"), true, "");
- statusWindow->addAttribute(DEX, _("Dexterity"), true, "");
- statusWindow->addAttribute(LUK, _("Luck"), true, "");
-
- statusWindow->addAttribute(ATK, _("Attack"), false, "");
- statusWindow->addAttribute(DEF, _("Defense"), false, "");
- statusWindow->addAttribute(MATK, _("M.Attack"), false, "");
- statusWindow->addAttribute(MDEF, _("M.Defense"), false, "");
- statusWindow->addAttribute(HIT, _("% Accuracy"), false, "");
- statusWindow->addAttribute(FLEE, _("% Evade"), false, "");
- statusWindow->addAttribute(CRIT, _("% Critical"), false, "");
-}
-
-void GeneralHandler::guiWindowsUnloaded()
-{
- socialWindow->removeTab(taGuild);
- socialWindow->removeTab(taParty);
-
- delete guildTab;
- guildTab = 0;
-
- delete partyTab;
- partyTab = 0;
-}
-
void GeneralHandler::clearHandlers()
{
mNetwork->clearHandlers();
}
-void GeneralHandler::stateChanged(State oldState, State newState)
+void GeneralHandler::event(const std::string &channel,
+ const Mana::Event &event)
{
- //
+ if (channel == "Game")
+ {
+ if (event.getName() == "GuiWindowsLoaded")
+ {
+ inventoryWindow->setSplitAllowed(false);
+ skillDialog->loadSkills("ea-skills.xml");
+
+ statusWindow->addAttribute(STR, _("Strength"), true, "");
+ statusWindow->addAttribute(AGI, _("Agility"), true, "");
+ statusWindow->addAttribute(VIT, _("Vitality"), true, "");
+ statusWindow->addAttribute(INT, _("Intelligence"), true, "");
+ statusWindow->addAttribute(DEX, _("Dexterity"), true, "");
+ statusWindow->addAttribute(LUK, _("Luck"), true, "");
+
+ statusWindow->addAttribute(ATK, _("Attack"), false, "");
+ statusWindow->addAttribute(DEF, _("Defense"), false, "");
+ statusWindow->addAttribute(MATK, _("M.Attack"), false, "");
+ statusWindow->addAttribute(MDEF, _("M.Defense"), false, "");
+ statusWindow->addAttribute(HIT, _("% Accuracy"), false, "");
+ statusWindow->addAttribute(FLEE, _("% Evade"), false, "");
+ statusWindow->addAttribute(CRIT, _("% Critical"), false, "");
+ }
+ else if (event.getName() == "GuiWindowsUnloading")
+ {
+ socialWindow->removeTab(taGuild);
+ socialWindow->removeTab(taParty);
+
+ delete guildTab;
+ guildTab = 0;
+
+ delete partyTab;
+ partyTab = 0;
+ }
+ }
}
} // namespace TmwAthena