summaryrefslogtreecommitdiff
path: root/src/net/tmwa/generalhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-02 03:12:14 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-02 03:12:14 +0300
commit40730c4fa73d403cf7284a76d9b26f7ec662afa4 (patch)
tree3bf9dce3ca6297a06193cdcc19cfdfa914fc48b2 /src/net/tmwa/generalhandler.cpp
parentab8c8cdae07d96cb18276a95b41ddb856c864958 (diff)
downloadmv-40730c4fa73d403cf7284a76d9b26f7ec662afa4.tar.gz
mv-40730c4fa73d403cf7284a76d9b26f7ec662afa4.tar.bz2
mv-40730c4fa73d403cf7284a76d9b26f7ec662afa4.tar.xz
mv-40730c4fa73d403cf7284a76d9b26f7ec662afa4.zip
Remove mNetwork field from MessageHandlers
Diffstat (limited to 'src/net/tmwa/generalhandler.cpp')
-rw-r--r--src/net/tmwa/generalhandler.cpp65
1 files changed, 15 insertions, 50 deletions
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 9ffa8164f..5abce494b 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -154,7 +154,7 @@ GeneralHandler::GeneralHandler() :
GeneralHandler::~GeneralHandler()
{
- delete2(mNetwork);
+ delete2(Network::mInstance);
}
void GeneralHandler::handleMessage(Net::MessageIn &msg)
@@ -175,49 +175,14 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg)
void GeneralHandler::load()
{
- mNetwork = new Network;
- mNetwork->registerHandlers();
-
- mNetwork->registerHandler(mAdminHandler);
- mNetwork->registerHandler(mBeingHandler);
- mNetwork->registerHandler(mBuySellHandler);
- mNetwork->registerHandler(mChatHandler);
- mNetwork->registerHandler(mCharServerHandler);
- mNetwork->registerHandler(mGameHandler);
- mNetwork->registerHandler(mGuildHandler);
- mNetwork->registerHandler(mInventoryHandler);
- mNetwork->registerHandler(mItemHandler);
- mNetwork->registerHandler(mLoginHandler);
- mNetwork->registerHandler(mNpcHandler);
- mNetwork->registerHandler(mPlayerHandler);
- mNetwork->registerHandler(mSkillHandler);
- mNetwork->registerHandler(mTradeHandler);
- mNetwork->registerHandler(mPartyHandler);
- mNetwork->registerHandler(mPetHandler);
- mNetwork->registerHandler(mQuestHandler);
-#ifdef EATHENA_SUPPORT
- mNetwork->registerHandler(mAuctionHandler);
- mNetwork->registerHandler(mBankHandler);
- mNetwork->registerHandler(mBattleGroundHandler);
- mNetwork->registerHandler(mBuyingStoreHandler);
- mNetwork->registerHandler(mCashShopHandler);
- mNetwork->registerHandler(mElementalHandler);
- mNetwork->registerHandler(mFamilyHandler);
- mNetwork->registerHandler(mFriendsHandler);
- mNetwork->registerHandler(mHomunculusHandler);
- mNetwork->registerHandler(mMailHandler);
- mNetwork->registerHandler(mMapHandler);
- mNetwork->registerHandler(mMarketHandler);
- mNetwork->registerHandler(mMercenaryHandler);
- mNetwork->registerHandler(mSearchStoreHandler);
- mNetwork->registerHandler(mVendingHandler);
-#endif
+ new Network;
+ Network::mInstance->registerHandlers();
}
void GeneralHandler::reload()
{
- if (mNetwork)
- mNetwork->disconnect();
+ if (Network::mInstance)
+ Network::mInstance->disconnect();
static_cast<LoginHandler*>(mLoginHandler)->clearWorlds();
CharServerHandler *const charHandler = static_cast<CharServerHandler*>(
@@ -239,28 +204,28 @@ void GeneralHandler::unload()
void GeneralHandler::flushSend()
{
- if (!mNetwork)
+ if (!Network::mInstance)
return;
- mNetwork->flush();
+ Network::mInstance->flush();
}
void GeneralHandler::flushNetwork()
{
- if (!mNetwork)
+ if (!Network::mInstance)
return;
BLOCK_START("GeneralHandler::flushNetwork 1")
- mNetwork->flush();
+ Network::mInstance->flush();
BLOCK_END("GeneralHandler::flushNetwork 1")
- mNetwork->dispatchMessages();
+ Network::mInstance->dispatchMessages();
BLOCK_START("GeneralHandler::flushNetwork 3")
- if (mNetwork->getState() == Network::NET_ERROR)
+ if (Network::mInstance->getState() == Network::NET_ERROR)
{
- if (!mNetwork->getError().empty())
+ if (!Network::mInstance->getError().empty())
{
- errorMessage = mNetwork->getError();
+ errorMessage = Network::mInstance->getError();
}
else
{
@@ -275,8 +240,8 @@ void GeneralHandler::flushNetwork()
void GeneralHandler::clearHandlers()
{
- if (mNetwork)
- mNetwork->clearHandlers();
+ if (Network::mInstance)
+ Network::mInstance->clearHandlers();
}
void GeneralHandler::gameStarted() const