duplicate status highlight rules
Noticed earlier when testing the status_hilite_menu_fld() changes: if you enter a duplicate rule (with different highlighting), it didn't replace the previous one and the old rule continued to be used. This still doesn't do replacement, but by adding the new rule at the end of the list of rules for the specified field instead of inserting it at the beginning, the new rule gets used.
This commit is contained in:
25
src/botl.c
25
src/botl.c
@@ -2351,7 +2351,7 @@ query_arrayvalue(
|
|||||||
static void
|
static void
|
||||||
status_hilite_add_threshold(int fld, struct hilite_s *hilite)
|
status_hilite_add_threshold(int fld, struct hilite_s *hilite)
|
||||||
{
|
{
|
||||||
struct hilite_s *new_hilite;
|
struct hilite_s *new_hilite, *old_hilite;
|
||||||
|
|
||||||
if (!hilite)
|
if (!hilite)
|
||||||
return;
|
return;
|
||||||
@@ -2362,8 +2362,16 @@ status_hilite_add_threshold(int fld, struct hilite_s *hilite)
|
|||||||
|
|
||||||
new_hilite->set = TRUE;
|
new_hilite->set = TRUE;
|
||||||
new_hilite->fld = fld;
|
new_hilite->fld = fld;
|
||||||
new_hilite->next = g.blstats[0][fld].thresholds;
|
new_hilite->next = (struct hilite_s *) 0;
|
||||||
g.blstats[0][fld].thresholds = new_hilite;
|
/* insert new entry at the end of the list */
|
||||||
|
if (!g.blstats[0][fld].thresholds) {
|
||||||
|
g.blstats[0][fld].thresholds = new_hilite;
|
||||||
|
} else {
|
||||||
|
for (old_hilite = g.blstats[0][fld].thresholds; old_hilite->next;
|
||||||
|
old_hilite = old_hilite->next)
|
||||||
|
continue;
|
||||||
|
old_hilite->next = new_hilite;
|
||||||
|
}
|
||||||
/* sort_hilites(fld) */
|
/* sort_hilites(fld) */
|
||||||
|
|
||||||
/* current and prev must both point at the same hilites */
|
/* current and prev must both point at the same hilites */
|
||||||
@@ -3680,12 +3688,11 @@ status_hilite_menu_add(int origfld)
|
|||||||
hilite.rel = TXT_VALUE;
|
hilite.rel = TXT_VALUE;
|
||||||
Strcpy(hilite.textmatch, aligntxt[rv]);
|
Strcpy(hilite.textmatch, aligntxt[rv]);
|
||||||
} else if (fld == BL_HUNGER) {
|
} else if (fld == BL_HUNGER) {
|
||||||
static const char *const hutxt[] = { "Satiated", (char *) 0, "Hungry",
|
static const char *const hutxt[] = {
|
||||||
"Weak", "Fainting", "Fainted",
|
"Satiated", (char *) 0, "Hungry", "Weak",
|
||||||
"Starved" };
|
"Fainting", "Fainted", "Starved"
|
||||||
int rv = query_arrayvalue(qry_buf,
|
};
|
||||||
hutxt,
|
int rv = query_arrayvalue(qry_buf, hutxt, SATIATED, STARVED + 1);
|
||||||
SATIATED, STARVED + 1);
|
|
||||||
|
|
||||||
if (rv < SATIATED)
|
if (rv < SATIATED)
|
||||||
goto choose_behavior;
|
goto choose_behavior;
|
||||||
|
|||||||
Reference in New Issue
Block a user