summaryrefslogtreecommitdiff
path: root/src/net/manaserv/playerhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/manaserv/playerhandler.cpp')
-rw-r--r--src/net/manaserv/playerhandler.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 2347fee2..33367927 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -56,6 +56,10 @@ extern Net::PlayerHandler *playerHandler;
namespace ManaServ {
+extern Connection *gameServerConnection;
+extern std::string netToken;
+extern ServerInfo gameServer;
+
void RespawnRequestListener::action(const gcn::ActionEvent &event)
{
Net::getPlayerHandler()->respawn();
@@ -65,8 +69,6 @@ void RespawnRequestListener::action(const gcn::ActionEvent &event)
handler->clearDialogs();
}
-extern Connection *gameServerConnection;
-
PlayerHandler::PlayerHandler()
{
static const Uint16 _messages[] = {
@@ -94,11 +96,18 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
break;
case GPMSG_PLAYER_SERVER_CHANGE:
- { // TODO: Implement reconnecting to another game server
- std::string token = msg.readString(32);
+ { // TODO: Fix the servers to test this
+ netToken = msg.readString(32);
std::string address = msg.readString();
int port = msg.readInt16();
logger->log("Changing server to %s:%d", address.c_str(), port);
+
+ gameServer.hostname = address;
+ gameServer.port = port;
+
+ gameServerConnection->disconnect();
+ Client::setState(STATE_CHANGE_MAP);
+ player_node->setMap(0);
} break;
case GPMSG_PLAYER_ATTRIBUTE_CHANGE: