From 8e05dde9c2f15c2a68039d64b15337f06ec0c1b7 Mon Sep 17 00:00:00 2001 From: Mario Kilies Date: Tue, 25 Jan 2011 09:38:02 +0100 Subject: Remove chosen card from hand. --- src/game.c | 5 ++++- src/hand.c | 7 +++++++ src/hand.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/game.c b/src/game.c index 9ba1835..275f9b5 100644 --- a/src/game.c +++ b/src/game.c @@ -68,7 +68,6 @@ static void main_loop_client(int sock) uint8_t open_card_idx; uint8_t picked_stack_idx; - while(running) { switch(state) @@ -97,6 +96,10 @@ static void main_loop_client(int sock) // Send open card to server net_send(sock, msg_type_selected_card, NULL); + // Remove picked open card from hand + hand_remove_card(&data->hand, open_card_idx); + ui_display_wnd_hand_cards(&data->hand, false, 0); + state = STATE_CLIENT_WAIT_FOR_OPEN_CARDS; break; diff --git a/src/hand.c b/src/hand.c index 42ecc05..3853697 100644 --- a/src/hand.c +++ b/src/hand.c @@ -17,3 +17,10 @@ void hand_sort(hand_t *h) qsort(h->cards, MAX_HAND_CARDS, sizeof(card), hand_comparator); } + +void hand_remove_card(hand_t *h, const uint8_t card_index) +{ + assert(h != NULL); + + h->cards[card_index] = 0; +} diff --git a/src/hand.h b/src/hand.h index f13eaf8..8202511 100644 --- a/src/hand.h +++ b/src/hand.h @@ -11,5 +11,6 @@ typedef struct } hand_t; void hand_sort(hand_t *h); +void hand_remove_card(hand_t *h, const uint8_t card_index); #endif // OXEN_HAND_H -- cgit v1.2.3