diff options
| author | totycro <totycro@unknown-horizons.org> | 2011-04-11 11:51:16 +0200 |
|---|---|---|
| committer | totycro <totycro@unknown-horizons.org> | 2011-04-11 11:51:16 +0200 |
| commit | 30c36b7549f8ae411f8eca4de144627331895a24 (patch) | |
| tree | 148a51093daa14f0e9019b3ed9188d5ae3e3d5cb /pacman-c++/server.cpp | |
| parent | e38dea479acf2d02c68af233e07b068f91afe935 (diff) | |
| download | foop-30c36b7549f8ae411f8eca4de144627331895a24.tar.gz foop-30c36b7549f8ae411f8eca4de144627331895a24.tar.bz2 foop-30c36b7549f8ae411f8eca4de144627331895a24.zip | |
First parameter for client is server ip
Added asserts to confirm that packets were parsed correctly
Diffstat (limited to 'pacman-c++/server.cpp')
| -rw-r--r-- | pacman-c++/server.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp index e7dd943..ba2b3c9 100644 --- a/pacman-c++/server.cpp +++ b/pacman-c++/server.cpp | |||
| @@ -137,6 +137,8 @@ void Server::waitForClientConnections() | |||
| 137 | ProtoBuf::WhoAmI packet; | 137 | ProtoBuf::WhoAmI packet; |
| 138 | packet.set_color(color); | 138 | packet.set_color(color); |
| 139 | Util::sendPacket(packet, socket); | 139 | Util::sendPacket(packet, socket); |
| 140 | |||
| 141 | qDebug() << "new player of col " << color; | ||
| 140 | } | 142 | } |
| 141 | } | 143 | } |
| 142 | 144 | ||
| @@ -164,7 +166,8 @@ void Server::keyPressUpdate() | |||
| 164 | std::string dataStr; | 166 | std::string dataStr; |
| 165 | Util::QByteArrayToStdString(socket->readAll(), dataStr); | 167 | Util::QByteArrayToStdString(socket->readAll(), dataStr); |
| 166 | ProtoBuf::KeyPressUpdate packet; | 168 | ProtoBuf::KeyPressUpdate packet; |
| 167 | packet.ParseFromString(dataStr); | 169 | bool worked = packet.ParseFromString(dataStr); |
| 170 | Q_ASSERT(worked); | ||
| 168 | Transmission::field_t direction = packet.newkey(); | 171 | Transmission::field_t direction = packet.newkey(); |
| 169 | qDebug() << "data:" << direction; | 172 | qDebug() << "data:" << direction; |
| 170 | m_actorMovements[color] = Util::transmissionMovementToActor(direction); | 173 | m_actorMovements[color] = Util::transmissionMovementToActor(direction); |
