diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-11 08:58:32 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-11 08:58:52 -0600 |
commit | 14a6e6a4bc5d39ddf8f31efc07a5e2493a6f6d0a (patch) | |
tree | da62e5694614e55df1c1a0fc5d5676ac7415daa6 /src/net | |
parent | 78cab005ab427e64ccdf8ba8f6ca7d4c6f6bd4b4 (diff) | |
download | mana-14a6e6a4bc5d39ddf8f31efc07a5e2493a6f6d0a.tar.gz mana-14a6e6a4bc5d39ddf8f31efc07a5e2493a6f6d0a.tar.bz2 mana-14a6e6a4bc5d39ddf8f31efc07a5e2493a6f6d0a.tar.xz mana-14a6e6a4bc5d39ddf8f31efc07a5e2493a6f6d0a.zip |
Remove more support #ifdefs
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/generalhandler.cpp | 30 | ||||
-rw-r--r-- | src/net/ea/generalhandler.h | 6 | ||||
-rw-r--r-- | src/net/generalhandler.h | 4 | ||||
-rw-r--r-- | src/net/tmwserv/generalhandler.cpp | 10 | ||||
-rw-r--r-- | src/net/tmwserv/generalhandler.h | 4 |
5 files changed, 53 insertions, 1 deletions
diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index 91406278..7d5a7d40 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -82,6 +82,11 @@ GeneralHandler::GeneralHandler(): generalHandler = this; } +GeneralHandler::~GeneralHandler() +{ + delete mNetwork; +} + void GeneralHandler::handleMessage(MessageIn &msg) { int code; @@ -140,11 +145,13 @@ void GeneralHandler::load() void GeneralHandler::unload() { mNetwork->clearHandlers(); - delete partyTab; } void GeneralHandler::flushNetwork() { + if (!mNetwork) + return; + mNetwork->flush(); mNetwork->dispatchMessages(); } @@ -154,9 +161,30 @@ bool GeneralHandler::isNetworkConnected() return mNetwork->isConnected(); } +void GeneralHandler::tick() +{ + if (!mNetwork) + return; + + if (mNetwork->getState() == Network::NET_ERROR) + { + state = STATE_ERROR; + + if (!mNetwork->getError().empty()) + errorMessage = mNetwork->getError(); + else + errorMessage = _("Got disconnected from server!"); + } +} + void GeneralHandler::guiWindowsLoaded() { partyTab = new PartyTab; } +void GeneralHandler::guiWindowsUnloaded() +{ + delete partyTab; +} + } // namespace EAthena diff --git a/src/net/ea/generalhandler.h b/src/net/ea/generalhandler.h index 3e2a6707..ebbc84ca 100644 --- a/src/net/ea/generalhandler.h +++ b/src/net/ea/generalhandler.h @@ -33,6 +33,8 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler public: GeneralHandler(); + ~GeneralHandler(); + void handleMessage(MessageIn &msg); void load(); @@ -43,8 +45,12 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler bool isNetworkConnected(); + void tick(); + void guiWindowsLoaded(); + void guiWindowsUnloaded(); + protected: MessageHandlerPtr mAdminHandler; MessageHandlerPtr mBeingHandler; diff --git a/src/net/generalhandler.h b/src/net/generalhandler.h index 08c08b13..57599ba1 100644 --- a/src/net/generalhandler.h +++ b/src/net/generalhandler.h @@ -34,7 +34,11 @@ class GeneralHandler virtual bool isNetworkConnected() = 0; + virtual void tick() = 0; + virtual void guiWindowsLoaded() = 0; + + virtual void guiWindowsUnloaded() = 0; }; } diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp index e9b06270..98c764c5 100644 --- a/src/net/tmwserv/generalhandler.cpp +++ b/src/net/tmwserv/generalhandler.cpp @@ -120,9 +120,19 @@ bool GeneralHandler::isNetworkConnected() return true; } +void GeneralHandler::tick() +{ + // TODO +} + void GeneralHandler::guiWindowsLoaded() { // TODO } +void GeneralHandler::guiWindowsUnloaded() +{ + // TODO +} + } // namespace TmwServ diff --git a/src/net/tmwserv/generalhandler.h b/src/net/tmwserv/generalhandler.h index 81a41608..08e18850 100644 --- a/src/net/tmwserv/generalhandler.h +++ b/src/net/tmwserv/generalhandler.h @@ -41,8 +41,12 @@ class GeneralHandler : public Net::GeneralHandler bool isNetworkConnected(); + void tick(); + void guiWindowsLoaded(); + void guiWindowsUnloaded(); + protected: MessageHandlerPtr mBeingHandler; MessageHandlerPtr mBuySellHandler; |