Merge branch 'NetHack-3.7' into win-wip3.7

This commit is contained in:
nhmall
2018-12-25 16:35:45 -05:00
6 changed files with 69 additions and 67 deletions

View File

@@ -337,6 +337,8 @@ a config file line with OPTIONS=symset:default, roguesymset:RogueEpyx
during the processing of symset:default done after RogueEpyx had during the processing of symset:default done after RogueEpyx had
already been processed already been processed
avoid potential segfault when doing 'more information' lookup avoid potential segfault when doing 'more information' lookup
when built with STATUS_HILITES enabled (the default), gold on status line
was missing '$' prefix for symset:Blank
tty: turn off an optimization that is the suspected cause of Windows reported tty: turn off an optimization that is the suspected cause of Windows reported
partial status lines following level changes partial status lines following level changes
tty: ensure that current status fields are always copied to prior status tty: ensure that current status fields are always copied to prior status

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 botl.c $NHDT-Date: 1544917592 2018/12/15 23:46:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.131 $ */ /* NetHack 3.6 botl.c $NHDT-Date: 1545705812 2018/12/25 02:43:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.132 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */ /*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -37,6 +37,14 @@ get_strength_str()
return buf; return buf;
} }
void
check_gold_symbol()
{
nhsym goldch = showsyms[COIN_CLASS + SYM_OFF_O];
iflags.invis_goldsym = (goldch <= (nhsym) ' ');
}
char * char *
do_statusline1() do_statusline1()
{ {
@@ -86,17 +94,6 @@ do_statusline1()
return newbot1; return newbot1;
} }
void
check_gold_symbol()
{
int goldch, goldoc;
unsigned int goldos;
int goldglyph = objnum_to_glyph(GOLD_PIECE);
(void) mapglyph(goldglyph, &goldch, &goldoc, &goldos, 0, 0);
iflags.invis_goldsym = ((char) goldch <= ' ');
}
char * char *
do_statusline2() do_statusline2()
{ {
@@ -125,7 +122,7 @@ do_statusline2()
money = 0L; /* ought to issue impossible() and then discard gold */ money = 0L; /* ought to issue impossible() and then discard gold */
Sprintf(eos(dloc), "%s:%-2ld", /* strongest hero can lift ~300000 gold */ Sprintf(eos(dloc), "%s:%-2ld", /* strongest hero can lift ~300000 gold */
(iflags.in_dumplog || iflags.invis_goldsym) ? "$" (iflags.in_dumplog || iflags.invis_goldsym) ? "$"
: encglyph(objnum_to_glyph(GOLD_PIECE)), : encglyph(objnum_to_glyph(GOLD_PIECE)),
min(money, 999999L)); min(money, 999999L));
dln = strlen(dloc); dln = strlen(dloc);
/* '$' encoded as \GXXXXNNNN is 9 chars longer than display will need */ /* '$' encoded as \GXXXXNNNN is 9 chars longer than display will need */
@@ -586,7 +583,8 @@ bot_via_windowport()
* sequence. * sequence.
*/ */
Sprintf(g.blstats[idx][BL_GOLD].val, "%s:%ld", Sprintf(g.blstats[idx][BL_GOLD].val, "%s:%ld",
encglyph(objnum_to_glyph(GOLD_PIECE)), (iflags.in_dumplog || iflags.invis_goldsym) ? "$"
: encglyph(objnum_to_glyph(GOLD_PIECE)),
g.blstats[idx][BL_GOLD].a.a_long); g.blstats[idx][BL_GOLD].a.a_long);
g.valset[BL_GOLD] = TRUE; /* indicate val already set */ g.valset[BL_GOLD] = TRUE; /* indicate val already set */
@@ -690,8 +688,7 @@ boolean *valsetlist;
* *
* Also, even if g.context.rndencode hasn't changed and the * Also, even if g.context.rndencode hasn't changed and the
* gold amount itself hasn't changed, the glyph portion of the * gold amount itself hasn't changed, the glyph portion of the
* encoding may have changed if a new symset was put into * encoding may have changed if a new symset was put into effect.
* effect.
* *
* \GXXXXNNNN:25 * \GXXXXNNNN:25
* XXXX = the g.context.rndencode portion * XXXX = the g.context.rndencode portion
@@ -714,7 +711,7 @@ boolean *valsetlist;
if (!g.update_all && !chg) { if (!g.update_all && !chg) {
reset = hilite_reset_needed(prev, g.bl_hilite_moves); reset = hilite_reset_needed(prev, g.bl_hilite_moves);
if (reset) if (reset)
curr->time = prev->time = 0L; curr->time = prev->time = 0L;
} }
#endif #endif

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 end.c $NHDT-Date: 1545646111 2018/12/24 10:08:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.160 $ */ /* NetHack 3.6 end.c $NHDT-Date: 1545771927 2018/12/25 21:05:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.161 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1534,12 +1534,7 @@ boolean identified, all_containers, reportempty;
{ {
register struct obj *box, *obj; register struct obj *box, *obj;
char buf[BUFSZ]; char buf[BUFSZ];
boolean cat, boolean cat, dumping = iflags.in_dumplog;
dumping =
#ifdef DUMPLOG
iflags.in_dumplog ? TRUE :
#endif
FALSE;
for (box = list; box; box = box->nobj) { for (box = list; box; box = box->nobj) {
if (Is_container(box) || box->otyp == STATUE) { if (Is_container(box) || box->otyp == STATUE) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 files.c $NHDT-Date: 1543395733 2018/11/28 09:02:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.244 $ */ /* NetHack 3.6 files.c $NHDT-Date: 1545702598 2018/12/25 01:49:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.248 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2994,7 +2994,8 @@ boolean FDECL((*proc), (char *));
*ep = '\0'; *ep = '\0';
/* trim off spaces at end of line */ /* trim off spaces at end of line */
while (--ep >= inbuf && (*ep == ' ' || *ep == '\t' || *ep == '\r')) while (--ep >= inbuf
&& (*ep == ' ' || *ep == '\t' || *ep == '\r'))
*ep = '\0'; *ep = '\0';
if (!config_error_nextline(inbuf)) { if (!config_error_nextline(inbuf)) {
@@ -3132,9 +3133,7 @@ int which_set;
config_error_add("Missing finish for symset \"%s\"", config_error_add("Missing finish for symset \"%s\"",
g.symset[which_set].name ? g.symset[which_set].name g.symset[which_set].name ? g.symset[which_set].name
: "unknown"); : "unknown");
config_error_done(); config_error_done();
return 1; return 1;
} }

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 wintty.c $NHDT-Date: 1544919891 2018/12/16 00:24:51 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.189 $ */ /* NetHack 3.6 wintty.c $NHDT-Date: 1545705819 2018/12/25 02:43:39 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.190 $ */
/* Copyright (c) David Cohrs, 1991 */ /* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -497,7 +497,7 @@ tty_player_selection()
goto give_up; goto give_up;
} }
makepicks: makepicks:
nextpick = RS_ROLE; nextpick = RS_ROLE;
do { do {
if (nextpick == RS_ROLE) { if (nextpick == RS_ROLE) {
@@ -965,7 +965,7 @@ makepicks:
tty_display_nhwindow(BASE_WINDOW, FALSE); tty_display_nhwindow(BASE_WINDOW, FALSE);
return; return;
give_up: give_up:
/* Quit */ /* Quit */
if (selected) if (selected)
free((genericptr_t) selected); /* [obsolete] */ free((genericptr_t) selected); /* [obsolete] */
@@ -1243,11 +1243,11 @@ tty_askname()
} }
#if defined(UNIX) || defined(VMS) #if defined(UNIX) || defined(VMS)
if (c != '-' && c != '@') if (c != '-' && c != '@')
if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z')
/* reject leading digit but allow digits elsewhere /* reject leading digit but allow digits elsewhere
(avoids ambiguity when character name gets (avoids ambiguity when character name gets
appended to uid to construct save file name) */ appended to uid to construct save file name) */
!(c >= '0' && c <= '9' && ct > 0)) && !(c >= '0' && c <= '9' && ct > 0))
c = '_'; c = '_';
#endif #endif
if (ct < (int) (sizeof g.plname) - 1) { if (ct < (int) (sizeof g.plname) - 1) {
@@ -1478,16 +1478,18 @@ winid window;
struct WinDesc *cw; struct WinDesc *cw;
boolean clear; boolean clear;
{ {
if (cw->offx == 0) if (cw->offx == 0) {
if (cw->offy) { if (cw->offy) {
tty_curs(window, 1, 0); tty_curs(window, 1, 0);
cl_eos(); cl_eos();
} else if (clear) } else if (clear) {
clear_screen(); clear_screen();
else } else {
docrt(); docrt();
else }
} else {
docorner((int) cw->offx, cw->maxrow + 1); docorner((int) cw->offx, cw->maxrow + 1);
}
} }
STATIC_OVL void STATIC_OVL void
@@ -2115,7 +2117,7 @@ struct WinDesc *cw;
tty_nhbell(); tty_nhbell();
break; break;
} else if (index(gacc, morc)) { } else if (index(gacc, morc)) {
group_accel: group_accel:
/* group accelerator; for the PICK_ONE case, we know that /* group accelerator; for the PICK_ONE case, we know that
it matches exactly one item in order to be in gacc[] */ it matches exactly one item in order to be in gacc[] */
invert_all(window, page_start, page_end, morc); invert_all(window, page_start, page_end, morc);
@@ -3395,15 +3397,16 @@ tty_nhgetch()
if (WIN_MESSAGE != WIN_ERR && wins[WIN_MESSAGE]) if (WIN_MESSAGE != WIN_ERR && wins[WIN_MESSAGE])
wins[WIN_MESSAGE]->flags &= ~WIN_STOP; wins[WIN_MESSAGE]->flags &= ~WIN_STOP;
if (iflags.debug_fuzzer) { if (iflags.debug_fuzzer) {
i = randomkey(); i = randomkey();
} else { } else {
#ifdef UNIX #ifdef UNIX
i = (++nesting == 1) ? tgetch() i = (++nesting == 1)
: (read(fileno(stdin), (genericptr_t) &nestbuf, 1) ? tgetch()
== 1) ? (int) nestbuf : EOF; : (read(fileno(stdin), (genericptr_t) &nestbuf, 1) == 1)
--nesting; ? (int) nestbuf : EOF;
--nesting;
#else #else
i = tgetch(); i = tgetch();
#endif #endif
} }
if (!i) if (!i)
@@ -3706,7 +3709,7 @@ boolean enable;
* BL_MASK_LEV 0x00000400L * BL_MASK_LEV 0x00000400L
* BL_MASK_FLY 0x00000800L * BL_MASK_FLY 0x00000800L
* BL_MASK_RIDE 0x00001000L * BL_MASK_RIDE 0x00001000L
* -- The value passed for BL_GOLD includes an encoded leading * -- The value passed for BL_GOLD usually includes an encoded leading
* symbol for GOLD "\GXXXXNNNN:nnn". If the window port needs to use * symbol for GOLD "\GXXXXNNNN:nnn". If the window port needs to use
* the textual gold amount without the leading "$:" the port will * the textual gold amount without the leading "$:" the port will
* have to skip past ':' in the passed "ptr" for the BL_GOLD case. * have to skip past ':' in the passed "ptr" for the BL_GOLD case.
@@ -3738,8 +3741,7 @@ unsigned long *colormasks;
int i; int i;
long *condptr = (long *) ptr; long *condptr = (long *) ptr;
char *text = (char *) ptr; char *text = (char *) ptr;
char *lastchar = (char *) 0; char *fval, *lastchar, *p;
char *fval = (char *) 0;
boolean reset_state = NO_RESET; boolean reset_state = NO_RESET;
if ((fldidx < BL_RESET) || (fldidx >= MAXBLSTATS)) if ((fldidx < BL_RESET) || (fldidx >= MAXBLSTATS))
@@ -3786,8 +3788,9 @@ unsigned long *colormasks;
/* The core botl engine sends a single blank to the window port /* The core botl engine sends a single blank to the window port
for carrying-capacity when its unused. Let's suppress that */ for carrying-capacity when its unused. Let's suppress that */
if (fldidx >= 0 && fldidx < MAXBLSTATS && if (fldidx >= 0 && fldidx < MAXBLSTATS
tty_status[NOW][fldidx].lth == 1 && status_vals[fldidx][0] == ' ') { && tty_status[NOW][fldidx].lth == 1
&& status_vals[fldidx][0] == ' ') {
status_vals[fldidx][0] = '\0'; status_vals[fldidx][0] = '\0';
tty_status[NOW][fldidx].lth = 0; tty_status[NOW][fldidx].lth = 0;
} }
@@ -3800,7 +3803,8 @@ unsigned long *colormasks;
hpbar_percent = percent; hpbar_percent = percent;
hpbar_color = (color & 0x00FF); hpbar_color = (color & 0x00FF);
} }
if (iflags.wc2_hitpointbar && (tty_procs.wincap2 & WC2_FLUSH_STATUS) != 0L) { if (iflags.wc2_hitpointbar
&& (tty_procs.wincap2 & WC2_FLUSH_STATUS) != 0L) {
tty_status[NOW][BL_TITLE].color = hpbar_color; tty_status[NOW][BL_TITLE].color = hpbar_color;
tty_status[NOW][BL_TITLE].dirty = TRUE; tty_status[NOW][BL_TITLE].dirty = TRUE;
} }
@@ -3823,7 +3827,9 @@ unsigned long *colormasks;
tty_status[NOW][fldidx].lth += 2; /* '[' and ']' */ tty_status[NOW][fldidx].lth += 2; /* '[' and ']' */
break; break;
case BL_GOLD: case BL_GOLD:
tty_status[NOW][fldidx].lth -= (10 - 1); /* \GXXXXNNNN counts as 1 */ /* \GXXXXNNNN counts as 1 */
if ((p = index(status_vals[fldidx], '\\')) != 0 && p[1] == 'G')
tty_status[NOW][fldidx].lth -= (10 - 1);
break; break;
case BL_CAP: case BL_CAP:
fval = status_vals[fldidx]; fval = status_vals[fldidx];
@@ -3858,7 +3864,7 @@ do_setlast()
last_on_row[row] = fld; last_on_row[row] = fld;
break; break;
} }
} }
STATIC_OVL int STATIC_OVL int
@@ -4394,8 +4400,7 @@ render_status(VOID_ARGS)
if (coloridx != NO_COLOR && coloridx != CLR_MAX) if (coloridx != NO_COLOR && coloridx != CLR_MAX)
term_start_color(coloridx); term_start_color(coloridx);
} }
tty_putstatusfield(&tty_status[NOW][idx], tty_putstatusfield(&tty_status[NOW][idx], text, x, y);
text, x, y);
if (iflags.hilite_delta) { if (iflags.hilite_delta) {
if (coloridx != NO_COLOR && coloridx != CLR_MAX) if (coloridx != NO_COLOR && coloridx != CLR_MAX)
term_end_color(); term_end_color();
@@ -4444,4 +4449,3 @@ render_status(VOID_ARGS)
#endif /* TTY_GRAPHICS */ #endif /* TTY_GRAPHICS */
/*wintty.c*/ /*wintty.c*/

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mswproc.c $NHDT-Date: 1536411259 2018/09/08 12:54:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.118 $ */ /* NetHack 3.6 mswproc.c $NHDT-Date: 1545705822 2018/12/25 02:43:42 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.130 $ */
/* Copyright (C) 2001 by Alex Kompel */ /* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -3084,24 +3084,29 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color,
case BL_GOLD: { case BL_GOLD: {
char buf[BUFSZ]; char buf[BUFSZ];
char *p; char *p;
ZeroMemory(buf, sizeof(buf)); ZeroMemory(buf, sizeof(buf));
mapglyph(objnum_to_glyph(GOLD_PIECE), &ochar, &ocolor, &ospecial, if (iflags.invis_goldsym)
0, 0); ochar = GOLD_SYM;
else
mapglyph(objnum_to_glyph(GOLD_PIECE),
&ochar, &ocolor, &ospecial, 0, 0);
buf[0] = ochar; buf[0] = ochar;
p = strchr(text, ':'); p = strchr(text, ':');
if (p) { if (p) {
strncpy(buf + 1, p, sizeof(buf) - 2); strncpy(buf + 1, p, sizeof(buf) - 2);
} else { } else {
buf[1] = ':'; buf[1] = ':';
strncpy(buf + 2, text, sizeof(buf) - 2); strncpy(buf + 2, text, sizeof(buf) - 3);
} }
buf[sizeof buf - 1] = '\0';
Sprintf(status_field->string, status_field->format ? status_field->format : "%s", buf); Sprintf(status_field->string,
status_field->format ? status_field->format : "%s", buf);
nhassert(status_string->str == status_field->string); nhassert(status_string->str == status_field->string);
} break; } break;
default: { default: {
Sprintf(status_field->string, status_field->format ? status_field->format : "%s", Sprintf(status_field->string,
text); status_field->format ? status_field->format : "%s", text);
nhassert(status_string->str == status_field->string); nhassert(status_string->str == status_field->string);
} break; } break;
} }