From de36871c582a4f228df71e15560c020f34d39d4a Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sat, 29 Jan 2011 16:20:40 +0100 Subject: added more documentation --- src/net/client.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/net/client.c') diff --git a/src/net/client.c b/src/net/client.c index 409de6a..72d7322 100644 --- a/src/net/client.c +++ b/src/net/client.c @@ -59,6 +59,11 @@ int client_connect_server(const char* host, const char* port) return sock; } +/** + * Parse received list of players and fill global player list + * @param[in] m Received message + * @return Indicates success + */ bool client_parse_player_list(const msg_t *m) { assert(m != NULL); @@ -83,6 +88,11 @@ bool client_parse_player_list(const msg_t *m) return true; } +/** + * Parse received hand and store it + * @param[in] m Received message + * @return Indicates success + */ bool client_parse_deal_hand(const msg_t *m) { assert(m != NULL); @@ -96,6 +106,11 @@ bool client_parse_deal_hand(const msg_t *m) return true; } +/** + * Parse received index of a selected stack and store it + * @param[in] m Received message + * @return Indicates success + */ bool client_parse_selected_stack(const msg_t *m) { assert(m != NULL); @@ -109,6 +124,11 @@ bool client_parse_selected_stack(const msg_t *m) return true; } +/** + * Parse received cards for initial stacks at beginning of game + * @param[in] m Received message + * @return Indicates success + */ bool client_parse_initial_stacks(const msg_t *m) { assert(m != NULL); @@ -121,6 +141,11 @@ bool client_parse_initial_stacks(const msg_t *m) return true; } +/** + * Parse received open cards of all players + * @param[in] m Received message + * @return Indicates success + */ bool client_parse_selected_card_all(const msg_t *m) { assert(m != NULL); @@ -137,6 +162,11 @@ bool client_parse_selected_card_all(const msg_t *m) return true; } +/** + * Parse received action for next round (whether new cards will be dealt ot the game is ending) + * @param[in] m Received message + * @return Indicates success + */ bool client_parse_next_action(const msg_t *m) { assert(m != NULL); @@ -148,6 +178,11 @@ bool client_parse_next_action(const msg_t *m) return true; } +/** + * Parse received hello answer from server with assigned player id + * @param[in] m Received message + * @return Indicates success + */ bool client_parse_hello(const msg_t *m) { assert(m != NULL); @@ -159,6 +194,10 @@ bool client_parse_hello(const msg_t *m) return true; } +/** + * Prepare hello message with client's nickname + * @param[out] m Pointer to message that should be filled + */ void client_prep_hello(msg_t *m) { data_store_t *ds = data_store(); @@ -168,6 +207,10 @@ void client_prep_hello(msg_t *m) m->hdr.payload_length = namelen; } +/** + * Prepare message with selected card + * @param[out] m Pointer to message that should be filled + */ void client_prep_selected_card(msg_t *m) { data_store_t *ds = data_store(); @@ -179,6 +222,10 @@ void client_prep_selected_card(msg_t *m) m->hdr.payload_length = 1; } +/** + * Prepare message with selected stack + * @param[out] m Pointer to message that should be filled + */ void client_prep_selected_stack(msg_t *m) { data_store_t *ds = data_store(); -- cgit v1.2.3