summaryrefslogtreecommitdiff
path: root/src/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/game.c b/src/game.c
index 6addee3..e2d8f88 100644
--- a/src/game.c
+++ b/src/game.c
@@ -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();