ranking of new status conditions

This commit is contained in:
nhmall
2020-02-08 19:51:04 -05:00
parent ce235dc94b
commit 67cc0183b0
4 changed files with 90 additions and 61 deletions
+8 -5
View File
@@ -975,6 +975,7 @@ curs_HPbar(char *text, /* pre-padded with trailing spaces if short */
/* conditions[] is used primarily for parsing hilite_status rules, but
we can use it for condition names and mask bits, avoiding duplication */
extern const struct conditions_t conditions[]; /* botl.c */
extern int cond_idx[CONDITION_COUNT];
static void
curs_stat_conds(int vert_cond, /* 0 => horizontal, 1 => vertical */
@@ -983,7 +984,7 @@ curs_stat_conds(int vert_cond, /* 0 => horizontal, 1 => vertical */
boolean *nohilite) /* optional output; indicates whether -*/
{ /*+ condbuf[] could be used as-is */
char condnam[20];
int i;
int i, ci;
long bitmsk;
if (condbuf) {
@@ -996,9 +997,10 @@ curs_stat_conds(int vert_cond, /* 0 => horizontal, 1 => vertical */
if (nohilite)
*nohilite = TRUE; /* assume ok */
for (i = 0; i < BL_MASK_BITS; ++i) {
bitmsk = conditions[i].mask;
ci = cond_idx[i];
bitmsk = conditions[ci].mask;
if (curses_condition_bits & bitmsk) {
Strcpy(condnam, conditions[i].text[0]);
Strcpy(condnam, conditions[ci].text[0]);
Strcat(strcat(condbuf, " "), upstart(condnam));
#ifdef STATUS_HILITES
if (nohilite && *nohilite
@@ -1024,9 +1026,10 @@ curs_stat_conds(int vert_cond, /* 0 => horizontal, 1 => vertical */
cond_bits = curses_condition_bits;
/* show active conditions directly; for vertical, three per line */
for (i = 0; i < BL_MASK_BITS; ++i) {
bitmsk = conditions[i].mask;
ci = cond_idx[i];
bitmsk = conditions[ci].mask;
if (cond_bits & bitmsk) {
Strcpy(condnam, conditions[i].text[0]);
Strcpy(condnam, conditions[ci].text[0]);
cndlen = 1 + (int) strlen(condnam); /* count leading space */
if (!do_vert) {
getyx(win, cy, cx);
+4 -3
View File
@@ -4409,7 +4409,7 @@ static void
render_status(VOID_ARGS)
{
long mask, bits;
int i, x, y, idx, c, row, tlth, num_rows, coloridx = 0, attrmask = 0;
int i, x, y, idx, c, ci, row, tlth, num_rows, coloridx = 0, attrmask = 0;
char *text;
struct WinDesc *cw = 0;
@@ -4473,7 +4473,8 @@ render_status(VOID_ARGS)
tty_curs(WIN_STATUS, x, y);
}
for (c = 0; c < SIZE(conditions) && bits != 0L; ++c) {
mask = conditions[c].mask;
ci = cond_idx[c];
mask = conditions[ci].mask;
if (bits & mask) {
const char *condtext;
@@ -4485,7 +4486,7 @@ render_status(VOID_ARGS)
if (coloridx != NO_COLOR)
term_start_color(coloridx);
}
condtext = conditions[c].text[cond_shrinklvl];
condtext = conditions[ci].text[cond_shrinklvl];
if (x >= cw->cols && !truncation_expected) {
impossible(
"Unexpected condition placement overflow for \"%s\"",