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/ui.c | |
| 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/ui.c')
| -rw-r--r-- | src/ui.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -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++; |
