curses options and status groundwork

More groundwork for overhauling the status display for curses, plus
a few functional changes.  It was doing a full status update for
every changed field (except conditions), instead of waiting for a
flush directive after gathering multiple changes at a time.  Since
it already does gather every change, the fix to wait is trivial.

This decouples 'hitpointbar' from 'statushilites'.  When highlighting
is off, it uses inverse video only.  When on, it behaves as before:
using inverse video plus the most recent color used to highlight HP
(which can vary if that has rules to highlight changes or percentage
thresholds) but ignoring any HP attribute(s).  This also enables the
latent 'statuslines' option and changes 'windowborders' option from
being settable at startup only to changeable during play.

'statuslines' can have a value of 2 (the default) or 3 and applies to
'align_status:bottom' or 'top'; it's ignored for 'left' and 'right'.
At the moment, setting it to 3 only allows status condition overflow
to wrap from the end of line to 2 to the beginning of line 3, and if
window borders are drawn they'll clobber the last character on line 2
and first one on line 3.  There's no point in trying to fix that
because it will go away when the main status overhaul changes go in.
Condition wrapping for vertical orientation (left or right placement)
was already subject to the same phenomenon and will be superseded too.

This also changes the meaning of the 'windowborders' value so could
impact players using source from git (or possibly beta binaries for
Windows, but not for OSX where curses interface wasn't included).
Old:
 0 = unspecified, 1 = On, 2 = Off, 3 = Auto (On if display is big
     enough, Off otherwise; reevaluated after dynamic resizing);
 Unspecified got changed to 3 during curses windowing initialization.
New:
 0 = Off, 1 = On, 2 = Auto;
 0 gets changed to 2 for default value at start of options processing.
So old value of 2 is changing meaning and explicit old value of 3 is
becoming invalid.  Implicit 3 changes to default 2.  Explicit 3 could
be the subject of a fixup but there isn't much point since 2 can't
have a similar fix.  Users who are using old 2 or explicit 3 will need
to update their run-time config files.

This adds 'statuslines' to the Guidebook and moves some other recently
added documentation of curses options from among the general options
(section 9.4) to "Window Port Customization options" (section 9.5).
None of them have been added to dat/opthelp which seems to be missing
all the wincap options.

Originally I made a lot of changes (mostly moving C99 declarations to
start of their blocks) to the old '#if 0' code at end of cursstat.c,
but have tossed those, except for one subtle bug that assumed 'int'
and 'long' are the same size.
This commit is contained in:
PatR
2019-03-21 14:33:39 -07:00
parent 7049145712
commit 5efea7115a
10 changed files with 336 additions and 282 deletions

View File

@@ -119,16 +119,14 @@ curses_create_main_windows()
boolean borders = FALSE;
switch (iflags.wc2_windowborders) {
case 0: /* Off */
borders = FALSE;
break;
case 1: /* On */
borders = TRUE;
break;
case 2: /* Off */
borders = FALSE;
break;
case 3: /* Auto */
if ((term_cols > 81) && (term_rows > 25)) {
borders = TRUE;
}
case 2: /* Auto */
borders = (term_cols > 81 && term_rows > 25);
break;
default:
borders = FALSE;
@@ -208,7 +206,7 @@ curses_create_main_windows()
int inv_width = 0;
int map_height = (term_rows - border_space);
int map_width = (term_cols - border_space);
int statusheight = (iflags.statuslines < 3) ? 2 : 3;
int statusheight = (iflags.wc2_statuslines < 3) ? 2 : 3;
boolean status_vertical = (status_orientation == ALIGN_LEFT
|| status_orientation == ALIGN_RIGHT);
boolean msg_vertical = (message_orientation == ALIGN_LEFT
@@ -221,7 +219,7 @@ curses_create_main_windows()
&status_width, &status_height,
status_orientation,
&map_x, &map_y, &map_width, &map_height,
border_space, statusheight, 26);
border_space, 20, 26);
if (iflags.perm_invent) {
/* Take up all width unless msgbar is also vertical. */
@@ -246,7 +244,7 @@ curses_create_main_windows()
&status_width, &status_height,
status_orientation,
&map_x, &map_y, &map_width, &map_height,
border_space, statusheight, 26);
border_space, statusheight, 0);
if (!msg_vertical)
set_window_position(&message_x, &message_y,
@@ -777,18 +775,13 @@ curses_character_dialog(const char **choices, const char *prompt)
void
curses_init_options()
{
set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS | WC_COLOR
| WC_HILITE_PET | WC_POPUP_DIALOG, SET_IN_GAME);
set_wc2_option_mod_status(WC2_GUICOLOR, SET_IN_GAME);
/* change these from DISP_IN_GAME to SET_IN_GAME */
set_wc_option_mod_status(WC_ALIGN_MESSAGE | WC_ALIGN_STATUS, SET_IN_GAME);
/* Remove a few options that are irrelevant to this windowport */
/*set_option_mod_status("DECgraphics", SET_IN_FILE); */
set_option_mod_status("eight_bit_tty", SET_IN_FILE);
/* Add those that are */
set_option_mod_status("statuslines", SET_IN_GAME);
/* Make sure that DECgraphics is not set to true via the config
file, as this will cause display issues. We can't disable it in
options.c in case the game is compiled with both tty and curses. */
@@ -800,15 +793,12 @@ curses_init_options()
#ifdef PDCURSES
/* PDCurses for SDL, win32 and OS/2 has the ability to set the
terminal size programatically. If the user does not specify a
size in the config file, we will set it to a nice big 110x32 to
size in the config file, we will set it to a nice big 32x110 to
take advantage of some of the nice features of this windowport. */
if (iflags.wc2_term_cols == 0) {
if (iflags.wc2_term_cols == 0)
iflags.wc2_term_cols = 110;
}
if (iflags.wc2_term_rows == 0) {
if (iflags.wc2_term_rows == 0)
iflags.wc2_term_rows = 32;
}
resize_term(iflags.wc2_term_rows, iflags.wc2_term_cols);
getmaxyx(base_term, term_rows, term_cols);
@@ -825,9 +815,6 @@ curses_init_options()
}
*/
#endif /* PDCURSES */
if (!iflags.wc2_windowborders) {
iflags.wc2_windowborders = 3; /* Set to auto if not specified */
}
/* fix up pet highlighting */
if (iflags.wc2_petattr == -1) /* shouldn't happen */

View File

@@ -20,8 +20,8 @@ struct window_procs curses_procs = {
#if defined(STATUS_HILITES)
| WC2_HILITE_STATUS
#endif
| WC2_HITPOINTBAR | WC2_FLUSH_STATUS
| WC2_TERM_SIZE | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR
| WC2_HITPOINTBAR | WC2_FLUSH_STATUS | WC2_TERM_SIZE
| WC2_STATUSLINES | WC2_WINDOWBORDERS | WC2_PETATTR | WC2_GUICOLOR
| WC2_SUPPRESS_HIST),
curses_init_nhwindows,
curses_player_selection,

View File

@@ -380,6 +380,7 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer)
curses_get_window_size(MESSAGE_WIN, &height, &width);
if (border) {
height -= 2, width -= 2;
border_space = 1;
if (mx < 1)
mx = 1;

View File

@@ -3,7 +3,6 @@
/* Copyright (c) Andy Thomson, 2018. */
/* NetHack may be freely redistributed. See license for details. */
#include <ctype.h> /* toupper() */
#include "curses.h"
#include "hack.h"
#include "wincurs.h"
@@ -28,9 +27,11 @@ static char *status_vals_long[MAXBLSTATS];
#ifdef STATUS_HILITES
static long curses_condition_bits;
static int curses_status_colors[MAXBLSTATS];
int hpbar_percent, hpbar_color;
static int hpbar_percent, hpbar_color;
#ifdef TEXTCOLOR
static int FDECL(condcolor, (long, unsigned long *));
#endif
static int FDECL(condattr, (long, unsigned long *));
#endif /* STATUS_HILITES */
static void FDECL(draw_status, (unsigned long *));
@@ -45,8 +46,8 @@ curses_status_init()
int i;
for (i = 0; i < MAXBLSTATS; ++i) {
curses_status_colors[i] = NO_COLOR; /* no color */
status_vals_long[i] = (char *) alloc(MAXCO);
curses_status_colors[i] = NO_COLOR; /* no color and no attributes */
status_vals_long[i] = (char *) alloc(MAXCO);
*status_vals_long[i] = '\0';
}
curses_condition_bits = 0L;
@@ -189,18 +190,19 @@ curses_status_finish()
#endif
void
curses_status_update(fldidx, ptr, chg, percent, color, colormasks)
int fldidx, chg UNUSED, percent, color;
curses_status_update(fldidx, ptr, chg, percent, color_and_attr, colormasks)
int fldidx, chg UNUSED,
percent, color_and_attr;
genericptr_t ptr;
unsigned long *colormasks;
{
long *condptr = (long *) ptr;
char *text = (char *) ptr;
char *goldnum = NULL;
static boolean oncearound = FALSE; /* prevent premature partial display */
boolean use_name = TRUE;
if (fldidx != BL_FLUSH) {
*status_vals[fldidx] = '\0';
if (!status_activefields[fldidx])
return;
if (fldidx == BL_GOLD)
@@ -208,7 +210,6 @@ unsigned long *colormasks;
switch (fldidx) {
case BL_CONDITION:
curses_condition_bits = *condptr;
oncearound = TRUE;
break;
case BL_TITLE:
case BL_HPMAX:
@@ -219,6 +220,15 @@ unsigned long *colormasks;
use_name = FALSE;
/* FALLTHROUGH */
default:
#ifndef TEXTCOLOR
color_and_attr = (color_and_attr & ~0x00FF) | NO_COLOR;
#endif
/*
* status_vals[] are used for horizontal orientation
* (wide lines of multiple short values).
* status_vals_long[] are used for vertical orientation
* (narrow-ish lines of one long value each).
*/
Sprintf(status_vals[fldidx],
(fldidx == BL_TITLE && iflags.wc2_hitpointbar) ? "%-30s" :
status_fieldfmt[fldidx] ? status_fieldfmt[fldidx] : "%s",
@@ -226,51 +236,36 @@ unsigned long *colormasks;
if (use_name) {
Sprintf(status_vals_long[fldidx], "%-16s: %s",
status_fieldnm[fldidx], goldnum ? goldnum : text);
*(status_vals_long[fldidx]) = toupper((*status_vals_long[fldidx]));
*(status_vals_long[fldidx]) = highc(*status_vals_long[fldidx]);
} else
Strcpy(status_vals_long[fldidx], status_vals[fldidx]);
#ifdef TEXTCOLOR
curses_status_colors[fldidx] = color;
#else
curses_status_colors[fldidx] = NO_COLOR;
#endif
curses_status_colors[fldidx] = color_and_attr;
if (iflags.wc2_hitpointbar && fldidx == BL_HP) {
hpbar_percent = percent;
#ifdef TEXTCOLOR
hpbar_color = color;
#else
hpbar_color = NO_COLOR;
#endif
hpbar_percent = percent;
hpbar_color = color_and_attr;
}
break;
}
} else { /* BL_FLUSH */
draw_status(colormasks);
}
if (!oncearound) return;
draw_status(colormasks);
}
void
draw_status(colormasks)
unsigned long *colormasks;
{
boolean horiz = FALSE;
WINDOW *win = curses_get_nhwin(STATUS_WIN);
int orient = curses_get_window_orientation(STATUS_WIN);
boolean horiz = (orient != ALIGN_RIGHT && orient != ALIGN_LEFT);
boolean border = curses_window_has_border(STATUS_WIN);
if ((orient != ALIGN_RIGHT) && (orient != ALIGN_LEFT))
horiz = TRUE;
/* Figure out if we have proper window dimensions for horizontal statusbar. */
/* Figure out if we have proper window dimensions for horizontal
statusbar. */
if (horiz) {
int ax = 0;
int ay = 0;
/* correct y */
int cy = 3;
if (iflags.statuslines < 3)
cy = 2;
int ax = 0, ay = 0;
int cy = (iflags.wc2_statuslines < 3) ? 2 : 3;
/* actual y (and x) */
getmaxyx(win, ay, ax);
@@ -278,16 +273,14 @@ unsigned long *colormasks;
ay -= 2;
if (cy != ay) { /* something changed. Redo everything */
curses_create_main_windows();
curses_last_messages();
doredraw();
curs_reset_windows(TRUE, TRUE);
win = curses_get_nhwin(STATUS_WIN);
}
}
werase(win);
if (horiz) {
if (iflags.statuslines < 3)
if (iflags.wc2_statuslines < 3)
draw_classic(border, colormasks);
else
draw_horizontal(border, colormasks);
@@ -305,7 +298,7 @@ draw_classic(border, colormasks)
boolean border;
unsigned long *colormasks;
{
enum statusfields fieldorder[2][15] = {
static const enum statusfields fieldorder[2][15] = {
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
BL_FLUSH },
@@ -313,33 +306,32 @@ unsigned long *colormasks;
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, BL_FLUSH }
};
#ifdef TEXTCOLOR
int coloridx = NO_COLOR;
#endif
int i, attrmask = 0;
int i, coloridx = NO_COLOR, attrmask = 0;
char *text;
int attridx = 0;
WINDOW *win = curses_get_nhwin(STATUS_WIN);
if (border) wmove(win, 1, 1);
else wmove(win, 0, 0);
if (border)
wmove(win, 1, 1);
else
wmove(win, 0, 0);
for (i = 0; fieldorder[0][i] != BL_FLUSH; ++i) {
int fldidx1 = fieldorder[0][i];
if (status_activefields[fldidx1]) {
if (fldidx1 != BL_TITLE || !iflags.wc2_hitpointbar) {
#ifdef TEXTCOLOR
coloridx = curses_status_colors[fldidx1] & 0x00FF;
#endif
attridx = (curses_status_colors[fldidx1] & 0xFF00) >> 8;
text = status_vals[fldidx1];
if (iflags.hilite_delta) {
coloridx = curses_status_colors[fldidx1]; /* plus attributes */
if (iflags.hilite_delta && coloridx != NO_COLOR) {
if (*text == ' ') {
putstr(STATUS_WIN, 0, " ");
text++;
}
/* multiple attributes can be in effect concurrently */
attridx = (coloridx >> 8) & 0x00FF;
Begin_Attr(attridx);
#ifdef TEXTCOLOR
coloridx &= 0x00FF;
if (coloridx != NO_COLOR && coloridx != CLR_MAX)
curses_toggle_color_attr(win, coloridx, NONE, ON);
#endif
@@ -350,7 +342,7 @@ unsigned long *colormasks;
if (iflags.hilite_delta) {
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
curses_toggle_color_attr(win, coloridx,NONE,OFF);
curses_toggle_color_attr(win, coloridx, NONE, OFF);
#endif
End_Attr(attridx);
}
@@ -377,54 +369,56 @@ unsigned long *colormasks;
*bar2 = '\0';
}
}
if (iflags.hilite_delta && iflags.wc2_hitpointbar) {
putstr(STATUS_WIN, 0, "[");
putstr(STATUS_WIN, 0, "[");
/* fixed attribute, not ((hpbar_color >> 8) & 0x00FF) */
wattron(win, A_REVERSE);
#ifdef TEXTCOLOR
if (iflags.hilite_delta) {
coloridx = hpbar_color & 0x00FF;
/* attridx = (hpbar_color & 0xFF00) >> 8; */
if (coloridx != NO_COLOR)
curses_toggle_color_attr(win,coloridx,NONE,ON);
curses_toggle_color_attr(win, coloridx, NONE, ON);
}
#endif
wattron(win,A_REVERSE);
putstr(STATUS_WIN, 0, bar);
wattroff(win,A_REVERSE);
putstr(STATUS_WIN, 0, bar);
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
curses_toggle_color_attr(win,coloridx,NONE,OFF);
if (iflags.hilite_delta && coloridx != NO_COLOR)
curses_toggle_color_attr(win, coloridx, NONE, OFF);
#endif
if (twoparts) {
*bar2 = savedch;
putstr(STATUS_WIN, 0, bar2);
}
putstr(STATUS_WIN, 0, "]");
} else
putstr(STATUS_WIN, 0, text);
wattroff(win, A_REVERSE);
if (twoparts) {
*bar2 = savedch;
putstr(STATUS_WIN, 0, bar2);
}
putstr(STATUS_WIN, 0, "]");
}
}
}
wclrtoeol(win);
if (border) wmove(win, 2, 1);
else wmove (win, 1, 0);
if (border)
wmove(win, 2, 1);
else
wmove (win, 1, 0);
for (i = 0; fieldorder[1][i] != BL_FLUSH; ++i) {
int fldidx2 = fieldorder[1][i];
if (status_activefields[fldidx2]) {
if (fldidx2 != BL_CONDITION) {
#ifdef TEXTCOLOR
coloridx = curses_status_colors[fldidx2] & 0x00FF;
#endif
attridx = (curses_status_colors[fldidx2] & 0xFF00) >> 8;
/* regular field, including title if no hitpointbar */
text = status_vals[fldidx2];
if (iflags.hilite_delta) {
coloridx = curses_status_colors[fldidx2]; /* plus attribute */
if (iflags.hilite_delta && coloridx != NO_COLOR) {
if (*text == ' ') {
putstr(STATUS_WIN, 0, " ");
text++;
}
attridx = (coloridx >> 8) & 0x00FF;
/* multiple attributes can be in effect concurrently */
Begin_Attr(attridx);
#ifdef TEXTCOLOR
coloridx &= 0x00FF;
if (coloridx != NO_COLOR && coloridx != CLR_MAX)
curses_toggle_color_attr(win,coloridx,NONE,ON);
curses_toggle_color_attr(win, coloridx, NONE, ON);
#endif
}
@@ -438,11 +432,11 @@ unsigned long *colormasks;
if (iflags.hilite_delta) {
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
curses_toggle_color_attr(win,coloridx,NONE,OFF);
curses_toggle_color_attr(win, coloridx, NONE, OFF);
#endif
End_Attr(attridx);
}
} else {
} else if (curses_condition_bits) {
MaybeDisplayCond(BL_MASK_STONE, "Stone");
MaybeDisplayCond(BL_MASK_SLIME, "Slime");
MaybeDisplayCond(BL_MASK_STRNGL, "Strngl");
@@ -480,7 +474,7 @@ draw_vertical(border, colormasks)
boolean border;
unsigned long *colormasks;
{
enum statusfields fieldorder[24] = {
static const enum statusfields fieldorder[24] = {
BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
BL_SCORE, BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX,
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
@@ -493,28 +487,29 @@ unsigned long *colormasks;
char *text;
int attridx = 0;
int x = 0, y = 0;
WINDOW *win = curses_get_nhwin(STATUS_WIN);
if (border) x++,y++;
if (border)
x++, y++;
for (i = 0; fieldorder[i] != BL_FLUSH; ++i) {
int fldidx1 = fieldorder[i];
if (status_activefields[fldidx1]) {
if (fldidx1 != BL_TITLE || !iflags.wc2_hitpointbar) {
if (fldidx1 != BL_CONDITION) {
#ifdef TEXTCOLOR
coloridx = curses_status_colors[fldidx1] & 0x00FF;
#endif
attridx = (curses_status_colors[fldidx1] & 0xFF00) >> 8;
text = status_vals_long[fldidx1];
if (iflags.hilite_delta) {
coloridx = curses_status_colors[fldidx1]; /* plus attr */
if (iflags.hilite_delta && coloridx != NO_COLOR) {
if (*text == ' ') {
putstr(STATUS_WIN, 0, " ");
text++;
}
/* multiple attributes can be in effect concurrently */
attridx = (coloridx >> 8) & 0x00FF;
Begin_Attr(attridx);
#ifdef TEXTCOLOR
coloridx &= 0x00FF;
if (coloridx != NO_COLOR && coloridx != CLR_MAX)
curses_toggle_color_attr(win, coloridx, NONE, ON);
#endif
@@ -523,20 +518,21 @@ unsigned long *colormasks;
if (fldidx1 != BL_HPMAX
&& fldidx1 != BL_ENEMAX
&& fldidx1 != BL_EXP)
wmove(win, y++, x); /* everything on a new line except the above */
wmove(win, y++, x); /* on next line unless the above */
putstr(STATUS_WIN, 0, text);
if (fldidx1 == BL_TITLE) y++;
if (fldidx1 == BL_TITLE)
y++;
if (iflags.hilite_delta) {
#ifdef TEXTCOLOR
if (coloridx != NO_COLOR)
curses_toggle_color_attr(win, coloridx,NONE,OFF);
curses_toggle_color_attr(win, coloridx, NONE, OFF);
#endif
End_Attr(attridx);
}
} else { /* condition */
} else if (curses_condition_bits) { /* BL_CONDITION */
MaybeDisplayCond(BL_MASK_STONE, "Stone");
MaybeDisplayCond(BL_MASK_SLIME, "Slime");
MaybeDisplayCond(BL_MASK_STRNGL, "Strngl");
@@ -561,7 +557,7 @@ unsigned long *colormasks;
text = status_vals[fldidx1];
getmaxyx(win, height, width);
bar_len = min(strlen(text), (size_t)width - (border ? 4 : 2));
bar_len = min((int) strlen(text), width - (border ? 4 : 2));
text[bar_len] = '\0';
if (bar_len < MAXCO-1) {
Strcpy(bar, text);
@@ -578,28 +574,29 @@ unsigned long *colormasks;
}
}
wmove(win, y++, x);
if (iflags.hilite_delta && iflags.wc2_hitpointbar) {
putstr(STATUS_WIN, 0, "[");
putstr(STATUS_WIN, 0, "[");
wattron(win, A_REVERSE); /* not (hpbar_color >> 8) & 0x00FF) */
#ifdef TEXTCOLOR
coloridx = hpbar_color & 0x00FF;
coloridx = hpbar_color & 0x00FF;
if (iflags.hilite_delta) {
/* attridx = (hpbar_color & 0xFF00) >> 8; */
if (coloridx != NO_COLOR)
curses_toggle_color_attr(win,coloridx,NONE,ON);
curses_toggle_color_attr(win, coloridx, NONE, ON);
#endif
wattron(win,A_REVERSE);
putstr(STATUS_WIN, 0, bar);
wattroff(win,A_REVERSE);
}
putstr(STATUS_WIN, 0, bar);
#ifdef TEXTCOLOR
if (iflags.hilite_delta) {
if (coloridx != NO_COLOR)
curses_toggle_color_attr(win,coloridx,NONE,OFF);
curses_toggle_color_attr(win, coloridx, NONE, OFF);
}
#endif
if (twoparts) {
*bar2 = savedch;
putstr(STATUS_WIN, 0, bar2);
}
putstr(STATUS_WIN, 0, "]");
} else
putstr(STATUS_WIN, 0, text);
wattroff(win,A_REVERSE);
if (twoparts) {
*bar2 = savedch;
putstr(STATUS_WIN, 0, bar2);
}
putstr(STATUS_WIN, 0, "]");
y++; /* blank line after title */
}
}
@@ -612,7 +609,8 @@ unsigned long *colormasks;
* Return what color this condition should
* be displayed in based on user settings.
*/
int condcolor(bm, bmarray)
static int
condcolor(bm, bmarray)
long bm;
unsigned long *bmarray;
{
@@ -620,39 +618,41 @@ unsigned long *bmarray;
if (bm && bmarray)
for (i = 0; i < CLR_MAX; ++i) {
if (bmarray[i] && (bm & bmarray[i]))
if ((bmarray[i] & bm) != 0)
return i;
}
return NO_COLOR;
}
#endif /* TEXTCOLOR */
int condattr(bm, bmarray)
static int
condattr(bm, bmarray)
long bm;
unsigned long *bmarray;
{
int attr = 0;
int i;
int i, attr = 0;
if (bm && bmarray) {
for (i = HL_ATTCLR_DIM; i < BL_ATTCLR_MAX; ++i) {
if (bmarray[i] && (bm & bmarray[i])) {
switch(i) {
case HL_ATTCLR_DIM:
attr |= HL_DIM;
break;
case HL_ATTCLR_BLINK:
attr |= HL_BLINK;
break;
case HL_ATTCLR_ULINE:
attr |= HL_ULINE;
break;
case HL_ATTCLR_INVERSE:
attr |= HL_INVERSE;
break;
case HL_ATTCLR_BOLD:
attr |= HL_BOLD;
break;
if ((bmarray[i] & bm) != 0) {
switch (i) {
case HL_ATTCLR_DIM:
attr |= HL_DIM;
break;
case HL_ATTCLR_BLINK:
attr |= HL_BLINK;
break;
case HL_ATTCLR_ULINE:
attr |= HL_ULINE;
break;
case HL_ATTCLR_INVERSE:
attr |= HL_INVERSE;
break;
case HL_ATTCLR_BOLD:
attr |= HL_BOLD;
break;
default:
break;
}
}
}
@@ -661,7 +661,8 @@ unsigned long *bmarray;
}
#endif /* STATUS_HILITES */
#if 0 /* old stuff to be re-incorporated */
#if 0 /* old stuff; some may be re-incorporated, most should be discarded */
/* Private declarations */
/* Used to track previous value of things, to highlight changes. */
@@ -673,7 +674,7 @@ typedef struct nhs {
static attr_t get_trouble_color(const char *);
static void draw_trouble_str(const char *);
static void print_statdiff(const char *append, nhstat *, int, int);
static void print_statdiff(const char *append, nhstat *, long, int);
static void get_playerrank(char *);
static int hpen_color(boolean, int, int);
static void draw_bar(boolean, int, int, const char *);
@@ -812,7 +813,7 @@ get_playerrank(char *rank)
type is generally STAT_OTHER (generic "do nothing special"),
but is used if the stat needs to be handled in a special way. */
static void
print_statdiff(const char *append, nhstat *stat, int new, int type)
print_statdiff(const char *append, nhstat *stat, long new, int type)
{
char buf[BUFSZ];
WINDOW *win = curses_get_nhwin(STATUS_WIN);