From 246e1678c54bedc7d0d0276654e5205647ff5360 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Thu, 20 Jan 2011 18:10:39 +0100 Subject: implemented functions for sending/receiving cards selected by a player --- src/net_client.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/net_client.c') 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 #include "net.h" #include "player.h" +#include "game.h" /** * Client side function; Send hello to server @@ -37,6 +38,24 @@ void client_hello(int sock, const char* username) free(buf); } +/** + * 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 -- cgit v1.2.3