summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-20 14:29:05 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-20 14:29:05 +0000
commit292f3e50a59b06bf129893b352466d7d54fa3d71 (patch)
tree7150b66c08c3dd83e79baef52332922ba3ab324d /src/net
parent0c90838cef0d75e14097dc66c6b5210eef976029 (diff)
downloadmana-292f3e50a59b06bf129893b352466d7d54fa3d71.tar.gz
mana-292f3e50a59b06bf129893b352466d7d54fa3d71.tar.bz2
mana-292f3e50a59b06bf129893b352466d7d54fa3d71.tar.xz
mana-292f3e50a59b06bf129893b352466d7d54fa3d71.zip
Fixed selection of player character and implemented sending of game and chat
server tokens. It gets you in the game (or what's left of it), but not on any map yet.
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;