curses: use existing background parameter for pile
The blue background colour for piles was implemented by changing glyph colour to curses colour pair with the desired background, and then passed to curses_putch which takes character and background colour and makes curses colour pair out of them once again. Pass blue background to curses_putch instead and let it create curses colour pair just once.
This commit is contained in:
@@ -145,7 +145,6 @@ 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);
|
||||
|
||||
@@ -940,6 +940,7 @@ curses_print_glyph(
|
||||
int glyph;
|
||||
int ch;
|
||||
int color;
|
||||
int framecolor;
|
||||
int nhcolor = 0;
|
||||
unsigned int special;
|
||||
int attr = -1;
|
||||
@@ -948,6 +949,7 @@ curses_print_glyph(
|
||||
special = glyphinfo->gm.glyphflags;
|
||||
ch = glyphinfo->ttychar;
|
||||
color = glyphinfo->gm.sym.color;
|
||||
framecolor = bkglyphinfo->framecolor;
|
||||
/* Extra color handling
|
||||
* FIQ: The curses library does not support truecolor, only the more limited 256
|
||||
* color mode. On top of this, the windowport only supports 16 color mode.
|
||||
@@ -981,7 +983,7 @@ curses_print_glyph(
|
||||
*/
|
||||
if ((special & MG_OBJPILE) && iflags.hilite_pile) {
|
||||
if (iflags.wc_color)
|
||||
color = get_framecolor(color, CLR_BLUE);
|
||||
framecolor = CLR_BLUE;
|
||||
else /* if (iflags.use_inverse) */
|
||||
attr = A_REVERSE;
|
||||
}
|
||||
@@ -1007,7 +1009,7 @@ curses_print_glyph(
|
||||
? glyphinfo->gm.u : NULL,
|
||||
#endif
|
||||
(nhcolor != 0) ? nhcolor : color,
|
||||
bkglyphinfo->framecolor, attr);
|
||||
framecolor, attr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -763,7 +763,7 @@ is_main_window(winid wid)
|
||||
coordinates without a refresh. Currently only used for the map. */
|
||||
|
||||
/* convert nhcolor (fg) and framecolor (bg) to curses colorpair */
|
||||
int
|
||||
static int
|
||||
get_framecolor(int nhcolor, int framecolor)
|
||||
{
|
||||
/* curses_toggle_color_attr() adds the +1 and takes care of COLORS < 16 */
|
||||
|
||||
Reference in New Issue
Block a user