diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-25 14:36:47 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-25 14:36:47 +0100 |
| commit | 49a31a58e1b77ed0d88c0271247d4f707cf8b641 (patch) | |
| tree | f7bd9907b5dbb5fd949a4e74d7a0b46e6fbf0179 /src/game.c | |
| parent | ffef04a78f6985e9fcff5454a608de24bd25388e (diff) | |
implement part of state_client_play_cards(); added new message type: hello reply from server which notifies clients of their player-ids
Diffstat (limited to 'src/game.c')
| -rw-r--r-- | src/game.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -110,10 +110,11 @@ void start_game(const bool servermode, const char* addr, const char* port) for(int i = 0; i < num_players; i++) { - net_recv(client_socks.sockets[i], msg_type_hello); - // assign ids (starting with 1; 0 is invalid) + net_recv(client_socks.sockets[i], msg_type_hello_c); + // assign ids (starting with 1; 0 is invalid) and notify clients of their ids client_socks.player_ids[i] = i+1; data->player_list.players[i].player_id = i+1; + net_send(client_socks.sockets[i], msg_type_hello_s, &data->player_list.players[i]); printf("Player connected: %s\n", data->player_list.players[i].player_name); } @@ -133,7 +134,8 @@ void start_game(const bool servermode, const char* addr, const char* port) data_store_t *data = data_store(); strncpy(data->nickname, "nickname", 10); - net_send(sock, msg_type_hello, NULL); + net_send(sock, msg_type_hello_c, NULL); + net_recv(sock, msg_type_hello_s); net_recv(sock, msg_type_start_game); ui_init(); |
