From c88a524298aa46157638a74416e8c6e968772758 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Thu, 20 Jan 2011 18:32:39 +0100 Subject: implemented functions for notifying server of selected tablestack and for broadcasting the selection results to all clients --- src/net.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index aca2423..bebbc6f 100644 --- a/src/net.h +++ b/src/net.h @@ -4,6 +4,7 @@ #include #include "player.h" #include "hand.h" +#include "table_stacks.h" // Offsets within the receive buffer to easily access the data fields of the received message #define NET_MSG_OFFSET_TYPE 0 @@ -13,10 +14,12 @@ typedef enum { // Specify message type identifiers here - msg_type_hello = 0x0, - msg_type_start_game = 0x1, - msg_type_deal_cards = 0x2, - msg_type_selected_card = 0x3 + msg_type_hello = 0x0, + msg_type_start_game = 0x1, + msg_type_deal_cards = 0x2, + msg_type_selected_card = 0x3, + msg_type_selected_stack_c = 0x4, + msg_type_selected_stack_s = 0x5 } msg_type_t; // Header format @@ -43,12 +46,16 @@ void server_start_game(int* clients, const uint8_t clientcount, const player_lis void server_deal_cards(int sock, const hand_t *h); char* server_recv_hello(const uint8_t* payload, const uint8_t payload_len); card* server_recv_selected_card(const uint8_t* payload, const uint8_t payload_len); +uint8_t* server_recv_selected_stack(const uint8_t* payload, const uint8_t payload_len); +void server_send_selected_stack(int* clients, const uint8_t clientcount, const uint8_t stackindex); // Client side functions int client_connect_server(const char* host, const char* port); void client_hello(int sock, const char* username); void client_selected_card(int sock, const card c); +void client_send_selected_stack(int sock, const uint8_t stackindex); player_list* client_recv_player_list(const uint8_t* payload, const uint8_t data_len); hand_t *client_recv_deal_cards(const uint8_t* payload, const uint8_t payload_len); +uint8_t* client_recv_selected_stack(const uint8_t* payload, const uint8_t payload_len); #endif // OXEN_NET_H -- cgit v1.2.3