summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/charserverhandler.cpp16
-rw-r--r--src/net/network.cpp1
2 files changed, 13 insertions, 4 deletions
diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp
index ea9b3196..2bf2c4b4 100644
--- a/src/net/charserverhandler.cpp
+++ b/src/net/charserverhandler.cpp
@@ -163,10 +163,9 @@ CharServerHandler::handleCharSelectResponse(MessageIn &msg)
{
int errMsg = msg.readByte();
- if (errMsg == 0)
+ if (errMsg == ERRMSG_OK)
{
- // TODO: Somehow be able to send this token once connected
- std::string token = msg.readString(32);
+ token = msg.readString(32);
std::string gameServer = msg.readString();
unsigned short gameServerPort = msg.readShort();
std::string chatServer = msg.readString();
@@ -178,6 +177,17 @@ CharServerHandler::handleCharSelectResponse(MessageIn &msg)
network->connect(Network::GAME, gameServer, gameServerPort);
network->connect(Network::CHAT, chatServer, chatServerPort);
+ // Keep the selected character and delete the others
+ player_node = mCharInfo->getEntry();
+ mCharInfo->unlock();
+ mCharInfo->select(0);
+ do {
+ LocalPlayer *tmp = mCharInfo->getEntry();
+ if (tmp != player_node)
+ delete tmp;
+ mCharInfo->next();
+ } while (mCharInfo->getPos());
+
state = STATE_CONNECT_GAME;
}
}
diff --git a/src/net/network.cpp b/src/net/network.cpp
index 911353b1..2ce6fc2b 100644
--- a/src/net/network.cpp
+++ b/src/net/network.cpp
@@ -192,7 +192,6 @@ void Network::flush()
break;
case ENET_EVENT_TYPE_RECEIVE:
- logger->log("Incoming data...");
dispatchMessage(event.packet);
break;