From 7ecc7781736e8648b12b23cfa08479a917b21069 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 5 Apr 2024 20:13:02 +0300 Subject: [PATCH] Curses: fix pile hilite background color The curses colorpair rework I did changed the pile hilite background color from blue to red. Change it back to blue, and use a function to get the color pair instead of hardcoding the value. --- include/wincurs.h | 1 + win/curses/cursmain.c | 2 +- win/curses/curswins.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/wincurs.h b/include/wincurs.h index d9042ed2d..d5b393691 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -149,6 +149,7 @@ extern void curses_puts(winid wid, int attr, const char *text); extern void curses_clear_nhwin(winid wid); extern void curses_alert_win_border(winid wid, boolean onoff); extern void curses_alert_main_borders(boolean onoff); +extern int get_framecolor(int nhcolor, int framecolor); extern void curses_draw_map(int sx, int sy, int ex, int ey); extern boolean curses_map_borders(int *sx, int *sy, int *ex, int *ey, int ux, int uy); diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index e99f26701..253bb3e75 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -954,7 +954,7 @@ curses_print_glyph( */ if ((special & MG_OBJPILE) && iflags.hilite_pile) { if (iflags.wc_color) - color = 16 + (color * 2) + 1; + color = get_framecolor(color, CLR_BLUE); else /* if (iflags.use_inverse) */ attr = A_REVERSE; } diff --git a/win/curses/curswins.c b/win/curses/curswins.c index f4963ec1a..d2168ec35 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -727,7 +727,8 @@ is_main_window(winid wid) /* Unconditionally write a single character to a window at the given coordinates without a refresh. Currently only used for the map. */ -static int +/* convert nhcolor (fg) and framecolor (bg) to curses colorpair */ +int get_framecolor(int nhcolor, int framecolor) { /* curses_toggle_color_attr() adds the +1 and takes care of COLORS < 16 */