Merge some bug1 fixes from NetHack-3.6

This commit is contained in:
nhmall
2020-01-13 15:55:01 -05:00
6 changed files with 123 additions and 90 deletions

View File

@@ -1,7 +1,7 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.12 $ $NHDT-Date: 1576638499 2019/12/18 03:08:19 $
$NHDT-Branch: Nethack-3.6 $:$NHDT-Revision: 1.14 $ $NHDT-Date: 1576976556 2019/12/22 01:02:36 $
fixes36.4 contains a terse summary of changes made to 3.6.3 in order to
produce 3.6.4.
produce 3.6.4 as well as any post-release fixes in binaries.
General Fixes and Modified Features
@@ -35,4 +35,3 @@ General New Features
--------------------
none

View File

@@ -7,6 +7,8 @@ focus will shift to the next major release.
General Fixes and Modified Features
-----------------------------------
have string_for_opt() return empty_optstr on failure
ensure existing callers of string_for_opt() check the return value before using it
Fixes to Post-3.6.4 Problems that Were Exposed Via git Repository
@@ -15,6 +17,7 @@ Fixes to Post-3.6.4 Problems that Were Exposed Via git Repository
Platform- and/or Interface-Specific Fixes or Features
-----------------------------------------------------
Windows OPTIONS=map_mode:fit_to_screen could cause a game start failure
General New Features

2
src/.gitignore vendored
View File

@@ -11,5 +11,5 @@ tiles.bmp
graphicschk
nhdat
o
nhdat370
nhdat*

View File

@@ -42,6 +42,8 @@ enum window_option_types {
#define PILE_LIMIT_DFLT 5
static char empty_optstr[] = {0};
/*
* NOTE: If you add (or delete) an option, please update the short
* options help (option_help()), the long options help (dat/opthelp),
@@ -1044,7 +1046,7 @@ boolean val_optional;
if (!colon || !*++colon) {
if (!val_optional)
config_error_add("Missing parameter for '%s'", opts);
return (char *) 0;
return empty_optstr;
}
return colon;
}
@@ -1057,7 +1059,7 @@ boolean val_optional;
{
if (!g.opt_initial) {
rejectoption(optname);
return (char *) 0;
return empty_optstr;
}
return string_for_opt(opts, val_optional);
}
@@ -1136,7 +1138,7 @@ const char *optype;
uchar translate[WARNCOUNT];
int length, i;
if (!(opts = string_for_env_opt(optype, opts, FALSE)))
if ((opts = string_for_env_opt(optype, opts, FALSE)) == empty_optstr)
return FALSE;
escapes(opts, opts);
@@ -1928,7 +1930,8 @@ char **opp;
if (negated) {
bad_negation(fullname, FALSE);
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
boolean val_negated = FALSE;
while ((*op == '!') || !strncmpi(op, "no", 2)) {
@@ -2125,7 +2128,8 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, fullname, 3, TRUE)) {
if (duplicate)
complain_about_duplicate(opts, 1);
if ((op = string_for_env_opt(fullname, opts, negated)) != 0) {
if ((op = string_for_env_opt(fullname, opts, negated))
!= empty_optstr) {
if (negated) {
bad_negation(fullname, TRUE);
return FALSE;
@@ -2167,7 +2171,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
nmcpy(g.catname, op, PL_PSIZ);
} else
return FALSE;
@@ -2182,7 +2187,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
nmcpy(g.dogname, op, PL_PSIZ);
} else
return FALSE;
@@ -2197,7 +2203,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
nmcpy(g.horsename, op, PL_PSIZ);
} else
return FALSE;
@@ -2212,7 +2219,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, (compat || !g.opt_initial));
if (!op) {
if (op == empty_optstr) {
if (compat || negated || g.opt_initial) {
/* for backwards compatibility, "mouse_support" without a
value is a synonym for mouse_support:1 */
@@ -2241,7 +2248,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, (compat || !g.opt_initial));
if (!op) {
if (op == empty_optstr) {
if (compat || negated || g.opt_initial) {
/* for backwards compatibility, "number_pad" without a
value is a synonym for number_pad:1 */
@@ -2284,7 +2291,7 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
} else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
g.symset[ROGUESET].name = dupstr(op);
if (!read_sym_file(ROGUESET)) {
clear_symsetentry(ROGUESET, TRUE);
@@ -2309,7 +2316,7 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
} else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
g.symset[PRIMARY].name = dupstr(op);
if (!read_sym_file(PRIMARY)) {
clear_symsetentry(PRIMARY, TRUE);
@@ -2332,7 +2339,7 @@ boolean tinitial, tfrom_file;
complain_about_duplicate(opts, 1);
if (negated) {
flags.runmode = RUN_TPORT;
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
} else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
if (!strncmpi(op, "teleport", strlen(op)))
flags.runmode = RUN_TPORT;
else if (!strncmpi(op, "run", strlen(op)))
@@ -2356,7 +2363,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
if (!add_menu_coloring(op))
return FALSE;
} else
@@ -2387,7 +2395,8 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_env_opt(fullname, opts, negated);
if ((negated && !op) || (!negated && op)) {
if ((negated && op == empty_optstr)
|| (!negated && op != empty_optstr)) {
iflags.msg_history = negated ? 0 : atoi(op);
} else if (negated) {
bad_negation(fullname, TRUE);
@@ -2405,7 +2414,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
if (!(op = string_for_opt(opts, TRUE))) {
if ((op = string_for_opt(opts, TRUE)) == empty_optstr) {
tmp = negated ? 's' : 'f';
} else {
if (negated) {
@@ -2474,7 +2483,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
if (opttype > 0 && !negated
&& (op = string_for_opt(opts, FALSE)) != 0) {
&& (op = string_for_opt(opts, FALSE)) != empty_optstr) {
switch (opttype) {
case MAP_OPTION:
iflags.wc_fontsiz_map = atoi(op);
@@ -2498,7 +2507,7 @@ boolean tinitial, tfrom_file;
config_error_add("Unknown %s parameter '%s'", fullname, opts);
return FALSE;
}
if (opttype > 0 && (op = string_for_opt(opts, FALSE)) != 0) {
if (opttype > 0 && (op = string_for_opt(opts, FALSE)) != empty_optstr) {
wc_set_font_name(opttype, op);
#ifdef MAC
set_font_name(opttype, op);
@@ -2543,12 +2552,12 @@ boolean tinitial, tfrom_file;
}
#ifdef WIN32
op = string_for_opt(opts, TRUE);
if (!alternative_palette(op)) {
if (op == empty_optstr || !alternative_palette(op)) {
config_error_add("Error in palette parameter '%s'", op);
return FALSE;
}
#else
if ((op = string_for_opt(opts, FALSE)) != (char *) 0) {
if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
char *pt = op;
int cnt, tmp, reverse;
long rgb;
@@ -2604,14 +2613,14 @@ boolean tinitial, tfrom_file;
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated || !g.opt_initial);
if (negated) {
if (op) {
if (op != empty_optstr) {
bad_negation("fruit", TRUE);
return FALSE;
}
op = &empty_str;
op = empty_optstr;
goto goodfruit;
}
if (!op)
if (op == empty_optstr)
return FALSE;
/* stripped leading and trailing spaces, condensed internal ones in 3.6.2 */
mungspaces(op);
@@ -2662,7 +2671,8 @@ boolean tinitial, tfrom_file;
if (negated) {
iflags.getpos_coords = GPCOORDS_NONE;
return retval;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
static char gpcoords[] = { GPCOORDS_NONE, GPCOORDS_COMPASS,
GPCOORDS_COMFULL, GPCOORDS_MAP,
GPCOORDS_SCREEN, '\0' };
@@ -2686,7 +2696,8 @@ boolean tinitial, tfrom_file;
if (negated) {
iflags.getloc_filter = GFILTER_NONE;
return retval;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
char c = lowc(*op);
switch (c) {
@@ -2732,9 +2743,10 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE);
return FALSE;
}
/* if (!(opts = string_for_env_opt(fullname, opts, FALSE)))
/* if ((opts = string_for_env_opt(fullname, opts, FALSE))
== empty_optstr)
*/
if (!(opts = string_for_opt(opts, FALSE)))
if ((opts = string_for_opt(opts, FALSE)) == empty_optstr)
return FALSE;
escapes(opts, opts);
/* note: dummy monclass #0 has symbol value '\0'; we allow that--
@@ -2783,7 +2795,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
nmcpy(g.plname, op, PL_NSIZ);
} else
return FALSE;
@@ -2798,7 +2811,7 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_opt(opts, negated)) != 0) {
} else if ((op = string_for_opt(opts, negated)) != empty_optstr) {
#if defined(WIN32) && defined(TTY_GRAPHICS)
set_altkeyhandler(op);
#endif
@@ -2812,7 +2825,7 @@ boolean tinitial, tfrom_file;
fullname = "align_status";
if (match_optname(opts, fullname, sizeof "align_status" - 1, TRUE)) {
op = string_for_opt(opts, negated);
if (op && !negated) {
if ((op != empty_optstr) && !negated) {
if (!strncmpi(op, "left", sizeof "left" - 1))
iflags.wc_align_status = ALIGN_LEFT;
else if (!strncmpi(op, "top", sizeof "top" - 1))
@@ -2839,7 +2852,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if (op && !negated) {
if ((op != empty_optstr) && !negated) {
if (!strncmpi(op, "left", sizeof "left" - 1))
iflags.wc_align_message = ALIGN_LEFT;
else if (!strncmpi(op, "top", sizeof "top" - 1))
@@ -2867,7 +2880,7 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if (!(op = string_for_opt(opts, FALSE)))
} else if ((op = string_for_opt(opts, FALSE)) == empty_optstr)
return FALSE;
if (!change_inv_order(op))
@@ -2886,7 +2899,7 @@ boolean tinitial, tfrom_file;
flags.paranoia_bits = 0; /* clear all */
if (negated) {
flags.paranoia_bits = 0; /* [now redundant...] */
} else if ((op = string_for_opt(opts, TRUE)) != 0) {
} else if ((op = string_for_opt(opts, TRUE)) != empty_optstr) {
char *pp, buf[BUFSZ];
strncpy(buf, op, sizeof buf - 1);
@@ -2952,7 +2965,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
switch (lowc(*op)) {
case 'u': /* Unencumbered */
flags.pickup_burden = UNENCUMBERED;
@@ -2995,7 +3009,7 @@ boolean tinitial, tfrom_file;
oc_to_str(flags.pickup_types, tbuf);
flags.pickup_types[0] = '\0'; /* all */
op = string_for_opt(opts, (compat || !g.opt_initial));
if (!op) {
if (op == empty_optstr) {
if (compat || negated || g.opt_initial) {
/* for backwards compatibility, "pickup" without a
value is a synonym for autopickup of all types
@@ -3067,12 +3081,12 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if ((negated && !op) || (!negated && op))
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr))
flags.pile_limit = negated ? 0 : atoi(op);
else if (negated) {
bad_negation(fullname, TRUE);
return FALSE;
} else /* !op */
} else /* op == empty_optstr */
flags.pile_limit = PILE_LIMIT_DFLT;
/* sanity check */
if (flags.pile_limit < 0)
@@ -3090,7 +3104,7 @@ boolean tinitial, tfrom_file;
if (duplicate || negated)
return FALSE;
op = string_for_opt(opts, FALSE);
if (!op)
if (op == empty_optstr)
return FALSE;
if (!strncmpi(op, "normal", 6) || !strcmpi(op, "play")) {
wizard = discover = FALSE;
@@ -3113,7 +3127,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if (op && !negated) {
if (op != empty_optstr && !negated) {
if (!strncmpi(op, "dialog", sizeof "dialog" - 1)) {
iflags.wc_player_selection = VIA_DIALOG;
} else if (!strncmpi(op, "prompt", sizeof "prompt" - 1)) {
@@ -3160,14 +3174,14 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, TRUE);
if (op && negated) {
if (op != empty_optstr && negated) {
bad_negation(fullname, TRUE);
return FALSE;
}
/* "disclose" without a value means "all with prompting"
and negated means "none without prompting" */
if (!op || !strcmpi(op, "all") || !strcmpi(op, "none")) {
if (op && !strcmpi(op, "none"))
if (op == empty_optstr || !strcmpi(op, "all") || !strcmpi(op, "none")) {
if (op != empty_optstr && !strcmpi(op, "none"))
negated = TRUE;
for (num = 0; num < NUM_DISCLOSURE_OPTIONS; num++)
flags.end_disclose[num] = negated
@@ -3232,7 +3246,7 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE);
return FALSE;
}
if (!(op = string_for_opt(opts, FALSE)))
if ((op = string_for_opt(opts, FALSE)) == empty_optstr)
return FALSE;
while (*op) {
@@ -3281,7 +3295,7 @@ boolean tinitial, tfrom_file;
fullname = "sortloot";
if (match_optname(opts, fullname, 4, TRUE)) {
op = string_for_env_opt(fullname, opts, FALSE);
if (op) {
if (op != empty_optstr) {
char c = lowc(*op);
switch (c) {
@@ -3307,7 +3321,7 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if (op)
} else if (op != empty_optstr)
(void) feature_alert_opts(op, fullname);
return retval;
}
@@ -3322,7 +3336,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
== empty_optstr) {
return FALSE;
}
if (!assign_videocolors(opts)) {
@@ -3339,7 +3354,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
== empty_optstr) {
return FALSE;
}
if (!assign_videoshades(opts)) {
@@ -3360,7 +3376,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
== empty_optstr) {
return FALSE;
}
if (!assign_video(opts)) {
@@ -3370,6 +3387,11 @@ boolean tinitial, tfrom_file;
return retval;
}
#endif /* NO_TERMS */
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
== empty_optstr) {
return FALSE;
}
}
#endif /* MSDOS */
/* WINCAP
@@ -3383,7 +3405,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if (op && !negated) {
if (op != empty_optstr && !negated) {
if (!strcmpi(op, "tiles"))
iflags.wc_map_mode = MAP_MODE_TILES;
else if (!strncmpi(op, "ascii4x6", sizeof "ascii4x6" - 1))
@@ -3431,7 +3453,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if ((negated && !op) || (!negated && op)) {
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
iflags.wc_scroll_amount = negated ? 1 : atoi(op);
} else if (negated) {
bad_negation(fullname, TRUE);
@@ -3447,7 +3469,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if ((negated && !op) || (!negated && op)) {
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
iflags.wc_scroll_margin = negated ? 5 : atoi(op);
} else if (negated) {
bad_negation(fullname, TRUE);
@@ -3465,7 +3487,7 @@ boolean tinitial, tfrom_file;
#if defined(WIN32)
} else {
op = string_for_opt(opts, 0);
if (!op)
if (op == empty_optstr)
return FALSE;
#ifdef TTY_GRAPHICS
map_subkeyvalue(op);
@@ -3482,7 +3504,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if ((negated && !op) || (!negated && op)) {
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
iflags.wc_tile_width = negated ? 0 : atoi(op);
} else if (negated) {
bad_negation(fullname, TRUE);
@@ -3496,7 +3518,7 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, fullname, sizeof "tile_file" - 1, TRUE)) {
if (duplicate)
complain_about_duplicate(opts, 1);
if ((op = string_for_opt(opts, FALSE)) != 0) {
if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
if (iflags.wc_tile_file)
free(iflags.wc_tile_file);
iflags.wc_tile_file = dupstr(op);
@@ -3511,7 +3533,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if ((negated && !op) || (!negated && op)) {
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
iflags.wc_tile_height = negated ? 0 : atoi(op);
} else if (negated) {
bad_negation(fullname, TRUE);
@@ -3527,7 +3549,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
if ((negated && !op) || (!negated && op)) {
if ((negated && op == empty_optstr) || (!negated && op != empty_optstr)) {
iflags.wc_vary_msgcount = negated ? 0 : atoi(op);
} else if (negated) {
bad_negation(fullname, TRUE);
@@ -3558,7 +3580,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
if (!iflags.windowtype_deferred) {
char buf[WINTYPELEN];
@@ -3578,7 +3601,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
} else if ((op = string_for_env_opt(fullname, opts, FALSE))
!= empty_optstr) {
char buf[WINTYPELEN];
nmcpy(buf, op, WINTYPELEN);
@@ -3597,7 +3621,7 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, fullname, 7, TRUE)) {
if (duplicate)
complain_about_duplicate(opts, 1);
if ((op = string_for_opt(opts, FALSE)) != 0) {
if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
if (!wc_set_window_colors(op)) {
config_error_add("Could not set %s '%s'", fullname, op);
return FALSE;
@@ -3620,22 +3644,23 @@ boolean tinitial, tfrom_file;
|| (fullname = "term_rows", match_optname(opts, fullname, 8, TRUE))) {
long ltmp;
op = string_for_opt(opts, negated);
ltmp = atol(op);
if (negated) {
bad_negation(fullname, FALSE);
retval = FALSE;
if ((op = string_for_opt(opts, negated)) != empty_optstr) {
ltmp = atol(op);
if (negated) {
bad_negation(fullname, FALSE);
retval = FALSE;
/* this just checks atol() sanity, not logical window size sanity */
} else if (ltmp <= 0L || ltmp >= (long) LARGEST_INT) {
config_error_add("Invalid %s: %ld", fullname, ltmp);
retval = FALSE;
/* this just checks atol() sanity, not logical window size sanity */
} else if (ltmp <= 0L || ltmp >= (long) LARGEST_INT) {
config_error_add("Invalid %s: %ld", fullname, ltmp);
retval = FALSE;
} else {
if (!strcmp(fullname, "term_rows"))
iflags.wc2_term_rows = (int) ltmp;
else /* !strcmp(fullname, "term_cols") */
iflags.wc2_term_cols = (int) ltmp;
} else {
if (!strcmp(fullname, "term_rows"))
iflags.wc2_term_rows = (int) ltmp;
else /* !strcmp(fullname, "term_cols") */
iflags.wc2_term_cols = (int) ltmp;
}
}
return retval;
}
@@ -3645,10 +3670,10 @@ boolean tinitial, tfrom_file;
fullname = "petattr";
if (match_optname(opts, fullname, sizeof "petattr" - 1, TRUE)) {
op = string_for_opt(opts, negated);
if (op && negated) {
if (op != empty_optstr && negated) {
bad_negation(fullname, TRUE);
retval = FALSE;
} else if (op) {
} else if (op != empty_optstr) {
#ifdef CURSES_GRAPHICS
int itmp = curses_read_attrs(op);
@@ -3679,7 +3704,7 @@ boolean tinitial, tfrom_file;
fullname = "windowborders";
if (match_optname(opts, fullname, 10, TRUE)) {
op = string_for_opt(opts, negated);
if (negated && op) {
if (negated && op != empty_optstr) {
bad_negation(fullname, TRUE);
retval = FALSE;
} else {
@@ -3687,7 +3712,7 @@ boolean tinitial, tfrom_file;
if (negated)
itmp = 0; /* Off */
else if (!op)
else if (op == empty_optstr)
itmp = 1; /* On */
else /* Value supplied; expect 0 (off), 1 (on), or 2 (auto) */
itmp = atoi(op);
@@ -3715,7 +3740,7 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, TRUE);
itmp = 2;
retval = FALSE;
} else if (op) {
} else if (op != empty_optstr) {
itmp = atoi(op);
}
if (itmp < 2 || itmp > 3) {
@@ -3737,7 +3762,7 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
if (!(op = string_for_opt(opts, !val_required))) {
if ((op = string_for_opt(opts, !val_required)) == empty_optstr) {
if (val_required)
return FALSE; /* string_for_opt gave feedback */
tmp = negated ? 'n' : 'f';
@@ -3778,7 +3803,8 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
} else if ((opts = string_for_env_opt(fullname, opts, FALSE))
== empty_optstr) {
return FALSE;
}
tmpattr = match_str2attr(opts, TRUE);
@@ -3798,7 +3824,7 @@ boolean tinitial, tfrom_file;
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
} else if ((op = string_for_opt(opts, FALSE)) != empty_optstr) {
char c, op_buf[BUFSZ];
escapes(op, op_buf);
@@ -3820,10 +3846,10 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, TRUE);
if (op && negated) {
if (op != empty_optstr && negated) {
clear_status_hilites();
return retval;
} else if (!op) {
} else if (op == empty_optstr) {
config_error_add("Value is mandatory for hilite_status");
return FALSE;
}
@@ -3844,7 +3870,7 @@ boolean tinitial, tfrom_file;
iflags.hilite_delta = 0L;
} else {
op = string_for_opt(opts, TRUE);
iflags.hilite_delta = (!op || !*op) ? 3L : atol(op);
iflags.hilite_delta = (op == empty_optstr || !*op) ? 3L : atol(op);
if (iflags.hilite_delta < 0L)
iflags.hilite_delta = 1L;
}
@@ -3992,7 +4018,7 @@ boolean tinitial, tfrom_file;
}
op = string_for_opt(opts, TRUE);
if (op) {
if (op != empty_optstr) {
if (negated) {
config_error_add(
"Negated boolean '%s' should not have a parameter",

View File

@@ -305,9 +305,14 @@ mswin_map_stretch(HWND hWnd, LPSIZE map_size, BOOL redraw)
}
/* TODO: Should we round instead of clamping? */
data->xFrontTile = (int) ((double) data->xBackTile * data->frontScale);
data->yFrontTile = (int) ((double) data->yBackTile * data->frontScale);
/* ensure tile is at least one pixel in size */
if (data->xFrontTile < 1) data->xFrontTile = 1;
if (data->yFrontTile < 1) data->yFrontTile = 1;
/* ensure front tile is non-zero in size */
data->xFrontTile = max(data->xFrontTile, 1);
data->yFrontTile = max(data->yFrontTile, 1);

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap mp rescap">
<Identity Name="30485NetHackDevTeam.NetHack3.6" Publisher="CN=8BDC628A-FAAA-4EBA-8B5B-EB61BA93BA1F" Version="363.0.21.0" />
<Identity Name="30485NetHackDevTeam.NetHack3.6" Publisher="CN=8BDC628A-FAAA-4EBA-8B5B-EB61BA93BA1F" Version="363.0.28.0" />
<Properties>
<DisplayName>NetHack 3.6</DisplayName>
<PublisherDisplayName>NetHack DevTeam</PublisherDisplayName>