diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-25 16:12:34 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-25 16:12:34 +0100 |
| commit | c7181ee943069bde7f5d468d11ee63c3a535980d (patch) | |
| tree | 56d8dd1128faa734fd0c63f78e1963d9640128d2 /src/client_game_states.c | |
| parent | 72504b3fa304c1bf0731fec80d3b85c5481ee0a2 (diff) | |
finished implementing play_cards function for client/server; added new message type next_action which indicates whether the game is finished or the server will deal new cards
Diffstat (limited to 'src/client_game_states.c')
| -rw-r--r-- | src/client_game_states.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/client_game_states.c b/src/client_game_states.c index 142693e..4fa4266 100644 --- a/src/client_game_states.c +++ b/src/client_game_states.c @@ -60,7 +60,7 @@ game_state_t state_client_wait_for_open_cards(const int sock) return STATE_CLIENT_SELECT_OPEN_CARD;; // just for testing } -game_state_t state_client_play_cards(const int sock, const uint8_t round) +game_state_t state_client_play_cards(const int sock) { data_store_t *ds = data_store(); @@ -103,23 +103,20 @@ game_state_t state_client_play_cards(const int sock, const uint8_t round) } } } -#if 0 - if (we_have_hand_cards) + + if(hand_count_cards(&ds->hand) > 0) // still cards in hand? { return STATE_CLIENT_SELECT_OPEN_CARD; } else { - receive_next_server_action(); - if (server_action == DEAL_CARDS) - { - round++; - return STATE_CLIENT_WAIT_FOR_CARDS; - } - else if (server_action == GAME_FINISHED) + net_recv(sock, msg_type_next_action); + if(!ds->game_finished) // no more cards -> server will deal + return STATE_CLIENT_WAIT_FOR_HAND_CARDS; + else return STATE_CLIENT_GAME_FINISHED; } -#endif + assert(false); return 1337; } |
