revise network system

This commit is contained in:
Eduardo Bart
2011-08-15 21:30:31 -03:00
parent be15b1820d
commit f87b475f49
26 changed files with 291 additions and 242 deletions

View File

@@ -1,13 +1,32 @@
#include "game.h"
#include "localplayer.h"
#include <otclient/net/protocolgame.h>
Game g_game;
Game::Game()
void Game::init()
{
m_online = false;
}
void Game::terminate()
{
if(m_online)
logout();
}
void Game::loginWorld(const std::string& account, const std::string& password, uint32 worldIp, uint16 worldPort, const std::string& characterName)
{
m_protocolGame = ProtocolGamePtr(new ProtocolGame);
m_protocolGame->login(account, password, worldIp, worldPort, characterName);
}
void Game::logout()
{
m_protocolGame->sendLogout();
onLogout();
}
void Game::onLogin()
{
m_localPlayer = LocalPlayerPtr(new LocalPlayer);
@@ -16,6 +35,7 @@ void Game::onLogin()
void Game::onLogout()
{
m_protocolGame.reset();
m_localPlayer.reset();
m_online = false;
}