From afe777a3cfa06fbdf391a338ba8506cf9cbcbb47 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Mon, 24 Jan 2011 22:05:57 +0100 Subject: server: send open cards to clients client: receive open cards from clients, sort and display them --- src/ui.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/ui.c') diff --git a/src/ui.c b/src/ui.c index 406ecb3..d416d37 100644 --- a/src/ui.c +++ b/src/ui.c @@ -215,6 +215,7 @@ void ui_display_wnd_stack_points(const table_stacks_t *ts, const bool highlight, void ui_display_wnd_current_state(const pnoc_t pnoc[], const uint8_t num_players, const uint8_t active_player, const uint32_t score) { assert(pnoc != NULL); + uint8_t pos = 0; wattron(w_current_state, A_BOLD); mvwprintw(w_current_state, 0, 0, "Current state:"); @@ -226,22 +227,27 @@ void ui_display_wnd_current_state(const pnoc_t pnoc[], const uint8_t num_players for (uint8_t i = 0; i < num_players; i++) { + if (pnoc[i].player_id == 0) // invalid player + continue; + if (i == active_player) wattron(w_current_state, COLOR_PAIR(CP_YELLOW_ON_BLACK)); - if (i < 5) + if (pos < 5) { - mvwprintw(w_current_state, 2+i, 1, "%-s", pnoc[i].player_name); - mvwprintw(w_current_state, 2+i, 13, "%3d", pnoc[i].open_card); + mvwprintw(w_current_state, 2+pos, 1, "%-s", pnoc[i].player_name); + mvwprintw(w_current_state, 2+pos, 13, "%3d", pnoc[i].open_card); } else { - mvwprintw(w_current_state, 2+(i-5), 22, "%-s", pnoc[i].player_name); - mvwprintw(w_current_state, 2+(i-5), 34, "%3d", pnoc[i].open_card); + 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 (i == active_player) wattroff(w_current_state, COLOR_PAIR(CP_YELLOW_ON_BLACK)); + + pos++; } wrefresh(w_current_state); -- cgit v1.2.3