From 493b581dfa5a06134f524fe026a2fde5c4a83af5 Mon Sep 17 00:00:00 2001 From: Mario Kilies Date: Sun, 16 Jan 2011 02:45:16 +0100 Subject: Renamed receive buffer offset macros. Changed argument data types of client_recv and server_recv. --- src/net_client.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/net_client.c') diff --git a/src/net_client.c b/src/net_client.c index 9aff39f..5e23e7a 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -26,9 +26,9 @@ void client_hello(int sock, const char* username) exit(EXIT_FAILURE); } - buf[INDEX_TYPE] = msg_type_hello; - buf[INDEX_LEN] = namelen+2; - memcpy(buf+INDEX_PAYLOAD, username, namelen); + buf[NET_MSG_OFFSET_TYPE] = msg_type_hello; + buf[NET_MSG_OFFSET_PAYLOAD_LENGTH] = namelen+2; + memcpy(buf+NET_MSG_OFFSET_PAYLOAD, username, namelen); send(sock, buf, namelen+2, 0); @@ -91,7 +91,7 @@ static player_list* client_recv_player_list(int sock, uint8_t data_len) recv(sock, buf, data_len, 0); - assert(buf[INDEX_TYPE] == msg_type_start_game); + assert(buf[NET_MSG_OFFSET_TYPE] == msg_type_start_game); players = malloc(sizeof(player_list)); if(players == NULL) @@ -100,7 +100,7 @@ static player_list* client_recv_player_list(int sock, uint8_t data_len) exit(EXIT_FAILURE); } - pos = INDEX_PAYLOAD; + pos = NET_MSG_OFFSET_PAYLOAD; players->count = buf[pos++]; // read usernames from buffer @@ -125,7 +125,7 @@ static hand* client_recv_deal_cards(int sock, uint8_t data_len) recv(sock, buf, data_len, 0); - assert(buf[INDEX_TYPE] == msg_type_deal_cards); + assert(buf[NET_MSG_OFFSET_TYPE] == msg_type_deal_cards); for(int i=0; i