diff options
Diffstat (limited to 'src/net_client.c')
| -rw-r--r-- | src/net_client.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/net_client.c b/src/net_client.c index 895041e..b51c7a0 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -8,6 +8,7 @@ #include <assert.h> #include "net.h" #include "player.h" +#include "game.h" /** * Client side function; Send hello to server @@ -38,6 +39,24 @@ void client_hello(int sock, const char* username) } /** + * Client side function; Send selected card to server + * @param[in] sock Socket to use + * @param[in] c Selected card + */ +void client_selected_card(int sock, const card c) +{ + assert(c >= MIN_CARD && c <= MAX_CARD); + + uint8_t buf[3]; + + buf[NET_MSG_OFFSET_TYPE] = msg_type_selected_card; + buf[NET_MSG_OFFSET_PAYLOAD_LENGTH] = 1; + buf[NET_MSG_OFFSET_PAYLOAD] = c; + + send(sock, buf, 3, 0); +} + +/** * Client side function; connects to specified host:port * @param[in] host Hostname of server * @param[in] port Port of server |
