summaryrefslogtreecommitdiff
path: root/src/net/tmwserv/generalhandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-09-30 19:54:06 -0600
committerJared Adams <jaxad0127@gmail.com>2009-09-30 19:54:06 -0600
commitd4f32a38fd498c180d562ced38a9129e0abf2252 (patch)
treee655b59ff686ad5fe2bdd11d6e072f5c3a4493b7 /src/net/tmwserv/generalhandler.cpp
parent6707d108790ab1fe1d4a3ef52d717966990fdf0a (diff)
downloadmana-d4f32a38fd498c180d562ced38a9129e0abf2252.tar.gz
mana-d4f32a38fd498c180d562ced38a9129e0abf2252.tar.bz2
mana-d4f32a38fd498c180d562ced38a9129e0abf2252.tar.xz
mana-d4f32a38fd498c180d562ced38a9129e0abf2252.zip
Merge login state machines for both clients
Also do some cleanup and refactoring of related code.
Diffstat (limited to 'src/net/tmwserv/generalhandler.cpp')
-rw-r--r--src/net/tmwserv/generalhandler.cpp60
1 files changed, 36 insertions, 24 deletions
diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp
index 011433fe..81bb46be 100644
--- a/src/net/tmwserv/generalhandler.cpp
+++ b/src/net/tmwserv/generalhandler.cpp
@@ -19,28 +19,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "net/tmwserv/generalhandler.h"
+
#include "gui/inventorywindow.h"
#include "gui/partywindow.h"
+#include "gui/register.h"
#include "gui/skilldialog.h"
#include "gui/specialswindow.h"
#include "gui/statuswindow.h"
-#include "net/tmwserv/generalhandler.h"
-
#include "net/tmwserv/network.h"
#include "net/tmwserv/connection.h"
#include "net/tmwserv/beinghandler.h"
#include "net/tmwserv/buysellhandler.h"
-#include "net/tmwserv/charserverhandler.h"
+#include "net/tmwserv/charhandler.h"
#include "net/tmwserv/chathandler.h"
#include "net/tmwserv/effecthandler.h"
+#include "net/tmwserv/gamehandler.h"
#include "net/tmwserv/guildhandler.h"
#include "net/tmwserv/inventoryhandler.h"
#include "net/tmwserv/itemhandler.h"
#include "net/tmwserv/loginhandler.h"
-#include "net/tmwserv/logouthandler.h"
-#include "net/tmwserv/maphandler.h"
#include "net/tmwserv/npchandler.h"
#include "net/tmwserv/partyhandler.h"
#include "net/tmwserv/playerhandler.h"
@@ -49,6 +49,8 @@
#include "utils/gettext.h"
+#include "main.h"
+
#include <list>
Net::GeneralHandler *generalHandler;
@@ -59,24 +61,29 @@ Net::Connection *accountServerConnection = 0;
namespace TmwServ {
+std::string netToken = "";
+ServerInfo gameServer;
+ServerInfo chatServer;
+
GeneralHandler::GeneralHandler():
- mBeingHandler(new BeingHandler),
- mBuySellHandler(new BuySellHandler),
- mCharServerHandler(new CharServerHandler),
- mChatHandler(new ChatHandler),
- mEffectHandler(new EffectHandler),
- mGuildHandler(new GuildHandler),
- mInventoryHandler(new InventoryHandler),
- mItemHandler(new ItemHandler),
- mLoginHandler(new LoginHandler),
- mLogoutHandler(new LogoutHandler),
- mMapHandler(new MapHandler),
- mNpcHandler(new NpcHandler),
- mPartyHandler(new PartyHandler),
- mPlayerHandler(new PlayerHandler),
- mTradeHandler(new TradeHandler),
- mSpecialHandler(new SpecialHandler)
+ mBeingHandler(new BeingHandler),
+ mBuySellHandler(new BuySellHandler),
+ mCharHandler(new CharHandler),
+ mChatHandler(new ChatHandler),
+ mEffectHandler(new EffectHandler),
+ mGameHandler(new GameHandler),
+ mGuildHandler(new GuildHandler),
+ mInventoryHandler(new InventoryHandler),
+ mItemHandler(new ItemHandler),
+ mLoginHandler(new LoginHandler),
+ mNpcHandler(new NpcHandler),
+ mPartyHandler(new PartyHandler),
+ mPlayerHandler(new PlayerHandler),
+ mTradeHandler(new TradeHandler),
+ mSpecialHandler(new SpecialHandler)
{
+ Net::initialize();
+
accountServerConnection = Net::getConnection();
gameServerConnection = Net::getConnection();
chatServerConnection = Net::getConnection();
@@ -98,15 +105,14 @@ void GeneralHandler::load()
{
Net::registerHandler(mBeingHandler.get());
Net::registerHandler(mBuySellHandler.get());
- Net::registerHandler(mCharServerHandler.get());
+ Net::registerHandler(mCharHandler.get());
Net::registerHandler(mChatHandler.get());
Net::registerHandler(mEffectHandler.get());
+ Net::registerHandler(mGameHandler.get());
Net::registerHandler(mGuildHandler.get());
Net::registerHandler(mInventoryHandler.get());
Net::registerHandler(mItemHandler.get());
Net::registerHandler(mLoginHandler.get());
- Net::registerHandler(mLogoutHandler.get());
- Net::registerHandler(mMapHandler.get());
Net::registerHandler(mNpcHandler.get());
Net::registerHandler(mPartyHandler.get());
Net::registerHandler(mPlayerHandler.get());
@@ -151,6 +157,7 @@ void GeneralHandler::guiWindowsLoaded()
{
inventoryWindow->setSplitAllowed(true);
partyWindow->clearPartyName();
+ RegisterDialog::setGender(NULL);
skillDialog->loadSkills("tmw-skills.xml");
specialsWindow->loadSpecials("specials.xml");
@@ -169,4 +176,9 @@ void GeneralHandler::guiWindowsUnloaded()
// TODO
}
+void GeneralHandler::clearHandlers()
+{
+ Net::clearHandlers();
+}
+
} // namespace TmwServ