summaryrefslogtreecommitdiff
path: root/src/client_game_states.c
diff options
context:
space:
mode:
authorMario Kilies <MarioKilies@GMX.net>2011-01-27 15:12:30 +0100
committerMario Kilies <MarioKilies@GMX.net>2011-01-27 15:12:30 +0100
commited42ff2ba16a521b9783ede5910eb3cf5df1887d (patch)
tree94aed311e9d8ba72843f501b3d7b684572a8a279 /src/client_game_states.c
parent7c5a0f2179cad03692ce3b47328a91e4817567fc (diff)
Switched from wrefresh() to wnoutrefresh() calls for UI display. Introduced ui_update() to update the screen.
Diffstat (limited to 'src/client_game_states.c')
-rw-r--r--src/client_game_states.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/client_game_states.c b/src/client_game_states.c
index 3fe262f..6d39ed7 100644
--- a/src/client_game_states.c
+++ b/src/client_game_states.c
@@ -9,6 +9,7 @@ game_state_t state_client_wait_for_hand_cards(const int sock, const uint8_t roun
data_store_t *d = data_store();
ui_display_wnd_messages("Waiting for hand cards from server", false);
+ ui_update();
if(round == 1)
{
@@ -16,11 +17,11 @@ game_state_t state_client_wait_for_hand_cards(const int sock, const uint8_t roun
net_recv(sock, msg_type_initial_stacks);
ui_display_wnd_table_cards(&d->table_stacks, false, 0);
ui_display_wnd_stack_points(&d->table_stacks, false, 0);
+ ui_update();
}
- // Wait for hand cards from server and display them
+ // Wait for hand cards from server
net_recv(sock, msg_type_deal_hand);
- ui_display_wnd_hand_cards(&d->hand, false, 0);
return STATE_CLIENT_SELECT_OPEN_CARD;
}
@@ -30,8 +31,6 @@ game_state_t state_client_select_open_card(const int sock)
data_store_t *d = data_store();
uint8_t open_card_idx;
- ui_display_wnd_messages("Please choose the card you want to play", true);
-
// Select open card
open_card_idx = ui_choose_card(&d->hand);
d->selected_card = d->hand.cards[open_card_idx];
@@ -42,6 +41,7 @@ game_state_t state_client_select_open_card(const int sock)
// Remove picked open card from hand
hand_remove_card(&d->hand, open_card_idx);
ui_display_wnd_hand_cards(&d->hand, false, 0);
+ ui_update();
return STATE_CLIENT_WAIT_FOR_OPEN_CARDS;
}
@@ -51,13 +51,13 @@ game_state_t state_client_wait_for_open_cards(const int sock)
data_store_t *d = data_store();
ui_display_wnd_messages("Waiting for the other players to pick their cards", false); // The two spaces between 'pick' and 'their' are intentionally and used for poor man's word wrap
+ ui_update();
net_recv(sock, msg_type_selected_card_all);
player_list_sort_by_open_card(&d->player_list, d->player_list.count); // sort in ascending order
player_list_entry_t *ple = get_player_list_entry_by_player_id(&d->player_list, d->own_player_id);
assert(ple != NULL);
- ui_display_wnd_current_state(&d->player_list, d->player_list.count, false, 0, ple->score);
return STATE_CLIENT_PLAY_CARDS;
}
@@ -74,13 +74,14 @@ game_state_t state_client_play_cards(const int sock)
uint8_t stack_idx = get_stack_idx_for_card(&ds->table_stacks, c);
bool our_turn = (ds->player_list.players[i].player_id == ds->own_player_id);
+ ui_display_wnd_messages("Placing cards...", false);
ui_display_wnd_current_state(&ds->player_list, ds->player_list.count, true, i, ple->score);
+ ui_update();
if(stack_idx >= NUM_TABLE_STACKS) // card does not fit on any stack
{
if(our_turn) // our turn to select stack
{
- ui_display_wnd_messages("Please choose a stack", true);
ds->stack_index = ui_choose_stack(&ds->table_stacks);
net_send(sock, msg_type_selected_stack_c, NULL);
}
@@ -120,6 +121,8 @@ game_state_t state_client_play_cards(const int sock)
ui_display_wnd_stack_points(&ds->table_stacks, false, 0);
}
+ ui_update();
+
// Wait between player turns, but not after the last one
if (i != ds->player_list.count - 1)
sleep(2);