From 9780e8c24b45cfb47085d77ae64ba1f91d31419e Mon Sep 17 00:00:00 2001 From: Mario Kilies Date: Tue, 25 Jan 2011 15:50:27 +0100 Subject: Implemented card_stack_push(). Renamed card_stack_clear() to card_stack_replace() and card_stack_upper_card() to card_stack_top(). Added documentation. --- src/client_game_states.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/client_game_states.c') diff --git a/src/client_game_states.c b/src/client_game_states.c index 142693e..2b11d51 100644 --- a/src/client_game_states.c +++ b/src/client_game_states.c @@ -80,7 +80,7 @@ game_state_t state_client_play_cards(const int sock, const uint8_t round) net_recv(sock, msg_type_selected_stack_s); ds->player_list.players[i].score += card_stack_get_points(&ds->table_stacks.stacks[ds->stack_index]); - card_stack_clear(&ds->table_stacks.stacks[ds->stack_index], c); + card_stack_replace(&ds->table_stacks.stacks[ds->stack_index], c); } else // card fits on a stack -> place it { @@ -88,19 +88,10 @@ game_state_t state_client_play_cards(const int sock, const uint8_t round) if(cs->cards[MAX_CARD_STACK_SIZE-1] != 0) // stack is full { ds->player_list.players[i].score += card_stack_get_points(cs); - card_stack_clear(cs, c); + card_stack_replace(cs, c); } else - { - // put open card on top of stack - for(int j=0; jcards[j] != 0) - continue; - cs->cards[j] = c; - break; - } - } + card_stack_push(cs, c); } } #if 0 -- cgit v1.2.3