diff options
| author | Mario Kilies <MarioKilies@GMX.net> | 2011-01-25 09:05:07 +0100 |
|---|---|---|
| committer | Mario Kilies <MarioKilies@GMX.net> | 2011-01-25 09:05:07 +0100 |
| commit | f11615206afc02bdc911fed5828ab881e3046380 (patch) | |
| tree | a1d587c9387df0fbe159098b3fa4f24b50fd0a2f /src | |
| parent | 4d26111501a131173857a20eb7050bc1b5f8e04a (diff) | |
ui_display_wnd_current_state() has now optional highlighting of a player in the table and is able to display '-' if the player has not played an open card (This is used to display the window before the actual gameplay has begun).
Diffstat (limited to 'src')
| -rw-r--r-- | src/game.c | 3 | ||||
| -rw-r--r-- | src/ui.c | 21 | ||||
| -rw-r--r-- | src/ui.h | 2 |
3 files changed, 17 insertions, 9 deletions
@@ -104,7 +104,7 @@ static void main_loop_client(int sock) net_recv(sock, msg_type_selected_card_all); pnoc_sort(data->players.players, data->players.count); // sort in ascending order - ui_display_wnd_current_state(data->players.players, data->players.count, 0, 0); // TODO fix parameters + ui_display_wnd_current_state(data->players.players, data->players.count, true, 0, 0); // TODO fix parameters //state = STATE_CLIENT_PLAY_CARDS; //sleep(2); @@ -339,6 +339,7 @@ void start_game(const bool servermode, const char* addr, const char* port) // Display all windows ui_display_wnd_table_cards(&data->table_stacks, false, 0); ui_display_wnd_stack_points(&data->table_stacks, false, 0); + ui_display_wnd_current_state(data->players.players, data->players.count, false, 0, 0); ui_display_wnd_hand_cards(&data->hand, false, 0); main_loop_client(sock); @@ -178,7 +178,7 @@ void ui_display_wnd_table_cards(const table_stacks_t *ts, const bool highlight, /** * Displays the stack points window. * @param[in] ts The table stacks used for calculation of stack points - * @param[in] highlight If true, stack poins will be highlighted + * @param[in] highlight If true, stack points will be highlighted * @param[in] highlighted_points The stack points to highlight. Only used, if highlight is true */ void ui_display_wnd_stack_points(const table_stacks_t *ts, const bool highlight, const uint8_t highlighted_points) @@ -209,10 +209,11 @@ void ui_display_wnd_stack_points(const table_stacks_t *ts, const bool highlight, * Displays the current state window, showing all player names and their open cards and the client player's score. * @param[in] pnoc Array of (player name, open card) tuples. Array has to be sorted by open card, lowest open card first * @param[in] num_players The number of players to show a player name and open card for - * @param[in] active_players The currently active player + * @param[in] highlight If true, a player in the player table will be highlighted + * @param[in] highlighted_player The player to highlight * @param[in] score The players score */ -void ui_display_wnd_current_state(const pnoc_t pnoc[], const uint8_t num_players, const uint8_t active_player, const uint32_t score) +void ui_display_wnd_current_state(const pnoc_t pnoc[], const uint8_t num_players, const bool highlight, const uint8_t highlighted_player, const uint32_t score) { assert(pnoc != NULL); uint8_t pos = 0; @@ -230,21 +231,27 @@ void ui_display_wnd_current_state(const pnoc_t pnoc[], const uint8_t num_players if (pnoc[i].player_id == 0) // invalid player continue; - if (i == active_player) + if (highlight && i == highlighted_player) wattron(w_current_state, COLOR_PAIR(CP_YELLOW_ON_BLACK)); if (pos < 5) { mvwprintw(w_current_state, 2+pos, 1, "%-s", pnoc[i].player_name); - mvwprintw(w_current_state, 2+pos, 13, "%3d", pnoc[i].open_card); + if (0 == pnoc[i].open_card) + mvwprintw(w_current_state, 2+pos, 15, "-"); + else + mvwprintw(w_current_state, 2+pos, 13, "%3d", pnoc[i].open_card); } else { mvwprintw(w_current_state, 2+(pos-5), 22, "%-s", pnoc[i].player_name); - mvwprintw(w_current_state, 2+(pos-5), 34, "%3d", pnoc[i].open_card); + if (0 == pnoc[i].open_card) + mvwprintw(w_current_state, 2+(pos-5), 36, "-"); + else + mvwprintw(w_current_state, 2+(pos-5), 34, "%3d", pnoc[i].open_card); } - if (i == active_player) + if (highlight && i == highlighted_player) wattroff(w_current_state, COLOR_PAIR(CP_YELLOW_ON_BLACK)); pos++; @@ -9,7 +9,7 @@ void ui_display_wnd_table_cards(const table_stacks_t *ts, const bool highlight, const uint8_t highlighted_stack); void ui_display_wnd_stack_points(const table_stacks_t *ts, const bool highlight, const uint8_t highlighted_points); -void ui_display_wnd_current_state(const pnoc_t pnoc[], const uint8_t num_players, const uint8_t active_player, const uint32_t score); +void ui_display_wnd_current_state(const pnoc_t pnoc[], const uint8_t num_players, const bool highlight, const uint8_t highlighted_player, const uint32_t score); void ui_display_wnd_hand_cards(const hand_t *h, const bool highlight, const uint8_t highlighted_card); uint8_t ui_choose_card(hand_t *h); uint8_t ui_choose_stack(const table_stacks_t *ts); |
