You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
772 B
42 lines
772 B
#include "game.h"
|
|
#include "localplayer.h"
|
|
#include <otclient/net/protocolgame.h>
|
|
|
|
Game g_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);
|
|
m_online = true;
|
|
}
|
|
|
|
void Game::onLogout()
|
|
{
|
|
m_protocolGame.reset();
|
|
m_localPlayer.reset();
|
|
m_online = false;
|
|
}
|