diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-20 18:10:39 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-20 18:10:39 +0100 |
| commit | 246e1678c54bedc7d0d0276654e5205647ff5360 (patch) | |
| tree | f71759b06cbfc073d0aacfb8d68065c672f9e420 /src/net_client.c | |
| parent | 4b9e56ebf47db8be740f4ff2a4b9fceb9f143055 (diff) | |
implemented functions for sending/receiving cards selected by a player
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 |
