Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2

This commit is contained in:
nhmall
2018-06-29 08:47:00 -04:00
2 changed files with 69 additions and 38 deletions

View File

@@ -52,12 +52,15 @@ when using the 'O' command to create a status highlight that specifies
separate rules for each attribute to be merged when highlighting separate rules for each attribute to be merged when highlighting
highlighting status conditions would fail to use attributes if a rule with highlighting status conditions would fail to use attributes if a rule with
them was followed by another one without (color only or color&normal) them was followed by another one without (color only or color&normal)
when using 'O' to set hilite_status rules, hide the 'score' status field if
game has been built without SCORE_ON_BOTL; latent rules for 'score'
can still be set in config file but can't be added or removed via 'O'
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
------------------------------------------------------------------ ------------------------------------------------------------------
fix access violation when --debug:xxxx has no other args after it fix access violation when --debug:xxxx has no other args after it
Setting the inverse attribute for gold had the space before "$:" setting the inverse attribute for gold had the space before "$:"
getting highlighted along with the gold field getting highlighted along with the gold field
sortloot segfaulted when filtering a subset of items (seen with 'A' command) sortloot segfaulted when filtering a subset of items (seen with 'A' command)

View File

@@ -924,6 +924,7 @@ init_blstats()
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
struct hilite_s *keep_hilite_chain = blstats[i][j].thresholds; struct hilite_s *keep_hilite_chain = blstats[i][j].thresholds;
#endif #endif
blstats[i][j] = initblstats[j]; blstats[i][j] = initblstats[j];
blstats[i][j].a = zeroany; blstats[i][j].a = zeroany;
if (blstats[i][j].valwidth) { if (blstats[i][j].valwidth) {
@@ -932,8 +933,7 @@ init_blstats()
} else } else
blstats[i][j].val = (char *) 0; blstats[i][j].val = (char *) 0;
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
if (keep_hilite_chain) blstats[i][j].thresholds = keep_hilite_chain;
blstats[i][j].thresholds = keep_hilite_chain;
#endif #endif
} }
} }
@@ -1204,26 +1204,28 @@ static struct fieldid_t {
const char *fieldname; const char *fieldname;
enum statusfields fldid; enum statusfields fldid;
} fieldids_alias[] = { } fieldids_alias[] = {
{"characteristics", BL_CHARACTERISTICS}, { "characteristics", BL_CHARACTERISTICS },
{"dx", BL_DX}, { "encumbrance", BL_CAP },
{"co", BL_CO}, { "experience-points", BL_EXP },
{"con", BL_CO}, { "dx", BL_DX },
{"points", BL_SCORE}, { "co", BL_CO },
{"cap", BL_CAP}, { "con", BL_CO },
{"pw", BL_ENE}, { "points", BL_SCORE },
{"pw-max", BL_ENEMAX}, { "cap", BL_CAP },
{"xl", BL_XP}, { "pw", BL_ENE },
{"xplvl", BL_XP}, { "pw-max", BL_ENEMAX },
{"ac", BL_AC}, { "xl", BL_XP },
{"hit-dice", BL_HD}, { "xplvl", BL_XP },
{"turns", BL_TIME}, { "ac", BL_AC },
{"hp", BL_HP}, { "hit-dice", BL_HD },
{"hp-max", BL_HPMAX}, { "turns", BL_TIME },
{"dgn", BL_LEVELDESC}, { "hp", BL_HP },
{"xp", BL_EXP}, { "hp-max", BL_HPMAX },
{"exp", BL_EXP}, { "dgn", BL_LEVELDESC },
{"flags", BL_CONDITION}, { "xp", BL_EXP },
{0, BL_FLUSH} { "exp", BL_EXP },
{ "flags", BL_CONDITION },
{0, BL_FLUSH }
}; };
/* format arguments */ /* format arguments */
@@ -1258,6 +1260,7 @@ const char *name;
if (!nmatches) { if (!nmatches) {
/* check partial matches to canonical names */ /* check partial matches to canonical names */
int len = (int) strlen(name); int len = (int) strlen(name);
for (i = 0; i < SIZE(initblstats); i++) for (i = 0; i < SIZE(initblstats); i++)
if (!strncmpi(name, initblstats[i].fldname, len)) { if (!strncmpi(name, initblstats[i].fldname, len)) {
fld = initblstats[i].fld; fld = initblstats[i].fld;
@@ -1286,7 +1289,8 @@ long augmented_time;
return FALSE; return FALSE;
while (tl) { while (tl) {
/* only this style times out */ /* only this style times out (includes general 'changed'
as well as specific 'up' and 'down') */
if (tl->behavior == BL_TH_UPDOWN) if (tl->behavior == BL_TH_UPDOWN)
return TRUE; return TRUE;
tl = tl->next; tl = tl->next;
@@ -1491,6 +1495,7 @@ int *colorptr;
case BL_TH_TEXTMATCH: case BL_TH_TEXTMATCH:
txtstr = blstats[idx][fldidx].val; txtstr = blstats[idx][fldidx].val;
if (fldidx == BL_TITLE) if (fldidx == BL_TITLE)
/* "<name> the <rank-title>", skip past "<name> the " */
txtstr += (strlen(plname) + sizeof " the " - sizeof ""); txtstr += (strlen(plname) + sizeof " the " - sizeof "");
if (hl->rel == TXT_VALUE && hl->textmatch[0]) { if (hl->rel == TXT_VALUE && hl->textmatch[0]) {
if (fuzzymatch(hl->textmatch, txtstr, "\" -_", TRUE)) { if (fuzzymatch(hl->textmatch, txtstr, "\" -_", TRUE)) {
@@ -1523,15 +1528,14 @@ split_clridx(idx, coloridx, attrib)
int idx; int idx;
int *coloridx, *attrib; int *coloridx, *attrib;
{ {
if (coloridx && attrib) { if (coloridx)
*coloridx = idx & 0x00FF; *coloridx = idx & 0x00FF;
if (attrib)
*attrib = (idx >> 8) & 0x00FF; *attrib = (idx >> 8) & 0x00FF;
}
} }
/* /*
* This is the parser for the hilite options * This is the parser for the hilite options.
* *
* parse_status_hl1() separates each hilite entry into * parse_status_hl1() separates each hilite entry into
* a set of field threshold/action component strings, * a set of field threshold/action component strings,
@@ -2422,17 +2426,18 @@ STATIC_OVL int
status_hilite_linestr_countfield(fld) status_hilite_linestr_countfield(fld)
int fld; int fld;
{ {
struct _status_hilite_line_str *tmp = status_hilite_str; struct _status_hilite_line_str *tmp;
boolean countall = (fld == BL_FLUSH);
int count = 0; int count = 0;
while (tmp) { for (tmp = status_hilite_str; tmp; tmp = tmp->next) {
if (tmp->fld == fld || fld == BL_FLUSH) if (countall || tmp->fld == fld)
count++; count++;
tmp = tmp->next;
} }
return count; return count;
} }
/* used by options handling, doset(options.c) */
int int
count_status_hilites(VOID_ARGS) count_status_hilites(VOID_ARGS)
{ {
@@ -2635,8 +2640,13 @@ status_hilite_menu_choose_field()
start_menu(tmpwin); start_menu(tmpwin);
for (i = 0; i < MAXBLSTATS; i++) { for (i = 0; i < MAXBLSTATS; i++) {
#ifndef SCORE_ON_BOTL
if (initblstats[i].fld == BL_SCORE
&& !blstats[0][BL_SCORE].thresholds)
continue;
#endif
any = zeroany; any = zeroany;
any.a_int = (i+1); any.a_int = (i + 1);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
initblstats[i].fldname, MENU_UNSELECTED); initblstats[i].fldname, MENU_UNSELECTED);
} }
@@ -3319,10 +3329,21 @@ int fld;
"Remove selected hilites", MENU_UNSELECTED); "Remove selected hilites", MENU_UNSELECTED);
} }
any = zeroany; #ifndef SCORE_ON_BOTL
any.a_int = -2; if (fld == BL_SCORE) {
add_menu(tmpwin, NO_GLYPH, &any, 'Z', 0, ATR_NONE, /* suppress 'Z - Add a new hilite' for 'score' when SCORE_ON_BOTL
"Add a new hilite", MENU_UNSELECTED); is disabled; we wouldn't be called for 'score' unless it has
hilite rules from the config file, so count must be positive
(hence there's no risk that we're putting up an empty menu) */
;
} else
#endif
{
any = zeroany;
any.a_int = -2;
add_menu(tmpwin, NO_GLYPH, &any, 'Z', 0, ATR_NONE,
"Add a new hilite", MENU_UNSELECTED);
}
Sprintf(buf, "Current %s hilites:", initblstats[fld].fldname); Sprintf(buf, "Current %s hilites:", initblstats[fld].fldname);
end_menu(tmpwin, buf); end_menu(tmpwin, buf);
@@ -3427,6 +3448,14 @@ shlmenu_redo:
int count = status_hilite_linestr_countfield(i); int count = status_hilite_linestr_countfield(i);
char buf[BUFSZ]; char buf[BUFSZ];
#ifndef SCORE_ON_BOTL
/* config file might contain rules for highlighting 'score'
even when SCORE_ON_BOTL is disabled; if so, 'O' command
menus will show them and allow deletions but not additions,
otherwise, it won't show 'score' at all */
if (initblstats[i].fld == BL_SCORE && !count)
continue;
#endif
any = zeroany; any = zeroany;
any.a_int = i + 1; any.a_int = i + 1;
Sprintf(buf, "%-18s", initblstats[i].fldname); Sprintf(buf, "%-18s", initblstats[i].fldname);
@@ -3436,7 +3465,6 @@ shlmenu_redo:
buf, MENU_UNSELECTED); buf, MENU_UNSELECTED);
} }
end_menu(tmpwin, "Status hilites:"); end_menu(tmpwin, "Status hilites:");
if ((res = select_menu(tmpwin, PICK_ONE, &picks)) > 0) { if ((res = select_menu(tmpwin, PICK_ONE, &picks)) > 0) {
i = picks->item.a_int - 1; i = picks->item.a_int - 1;