-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswClientInitMsg.cpp
More file actions
37 lines (30 loc) · 889 Bytes
/
swClientInitMsg.cpp
File metadata and controls
37 lines (30 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "swClientInitMsg.h"
swClientInitMsg::swClientInitMsg() {
type = SW_CLIENT_INIT_MSG;
}
swClientInitMsg::~swClientInitMsg() {
}
void swClientInitMsg::read(swStream* stream) {
settings.read(stream);
int playerCount = stream->readInt();
for(int i = 0; i < playerCount; i++) {
swPlayer player;
player.read(stream);
players.append(player);
}
}
void swClientInitMsg::write(swStream* stream) {
settings.write(stream);
stream->writeInt(players.count());
foreach(swPlayer player, players) {
player.write(stream);
}
}
void swClientInitMsg::servHandle(swServer* server, QTcpSocket* sock) {
// this message is sent by the server
}
void swClientInitMsg::cliHandle(swClient* client) {
// on receive, the client's lists are updated
client->players = players;
client->game->settings = settings;
}