Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-01-31 19:48:51 -05:00
10 changed files with 93 additions and 97 deletions

View File

@@ -3030,8 +3030,8 @@ choose_value:
op, aval.a_int, is_out_of_range);
goto choose_value;
} else if (dt == ANY_LONG
&& (aval.a_long < (lt_gt_eq == GT_VALUE) ? -1L
: (lt_gt_eq == LT_VALUE) ? 1L : 0L)) {
&& (aval.a_long < ((lt_gt_eq == GT_VALUE) ? -1L
: (lt_gt_eq == LT_VALUE) ? 1L : 0L))) {
pline("%s'%s%ld'%s", threshold_value,
op, aval.a_long, is_out_of_range);
goto choose_value;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1547512504 2019/01/15 00:35:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.328 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1548978603 2019/01/31 23:50:03 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.330 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -810,7 +810,7 @@ wiz_makemap(VOID_ARGS)
unplacebc();
}
/* reset lock picking unless it's for a carried container */
maybe_reset_pick();
maybe_reset_pick((struct obj *) 0);
/* reset interrupted digging if it was taking place on this level */
if (on_level(&g.context.digging.level, &u.uz))
(void) memset((genericptr_t) &g.context.digging, 0,

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do.c $NHDT-Date: 1547680082 2019/01/16 23:08:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.186 $ */
/* NetHack 3.6 do.c $NHDT-Date: 1548978604 2019/01/31 23:50:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.189 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1315,7 +1315,7 @@ boolean at_stairs, falling, portal;
for lock-picking, container may be carried, in which case we
keep context; if on the floor, it's about to be saved+freed and
maybe_reset_pick() needs to do its carried() check before that */
maybe_reset_pick();
maybe_reset_pick((struct obj *) 0);
reset_trapset(); /* even if to-be-armed trap obj is accompanying hero */
iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination cache */
g.context.polearm.hitmon = (struct monst *) 0; /* polearm target */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 lock.c $NHDT-Date: 1547086531 2019/01/10 02:15:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.83 $ */
/* NetHack 3.6 lock.c $NHDT-Date: 1548978605 2019/01/31 23:50:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.84 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -244,10 +244,14 @@ forcelock(VOID_ARGS)
return 1; /* still busy */
You("succeed in forcing the lock.");
exercise(g.xlock.picktyp ? A_DEX : A_STR, TRUE);
/* breakchestlock() might destroy g.xlock.box; if so, g.xlock context will
be cleared (delobj -> obfree -> maybe_reset_pick); but it might not,
so explicitly clear that manually */
breakchestlock(g.xlock.box, (boolean) (!g.xlock.picktyp && !rn2(3)));
reset_pick(); /* lock-picking context is no longer valid */
exercise((g.xlock.picktyp) ? A_DEX : A_STR, TRUE);
return ((g.xlock.usedtime = 0));
return 0;
}
void
@@ -255,15 +259,28 @@ reset_pick()
{
g.xlock.usedtime = g.xlock.chance = g.xlock.picktyp = 0;
g.xlock.magic_key = FALSE;
g.xlock.door = 0;
g.xlock.box = 0;
g.xlock.door = (struct rm *) 0;
g.xlock.box = (struct obj *) 0;
}
/* level change; don't reset if hero is carrying xlock.box with him/her */
/* level change or object deletion; context may no longer be valid */
void
maybe_reset_pick()
maybe_reset_pick(container)
struct obj *container; /* passed from obfree() */
{
if (!g.xlock.box || !carried(g.xlock.box))
/*
* If a specific container, only clear context if it is for that
* particular container (which is being deleted). Other stuff on
* the current dungeon level remains valid.
* However if 'container' is Null, clear context if not carrying
* g.xlock.box (which might be Null if context is for a door).
* Used for changing levels, where a floor container or a door is
* being left behind and won't be valid on the new level but a
* carried container will still be. There might not be any context,
* in which case redundantly clearing it is harmless.
*/
if (container ? (container == g.xlock.box)
: (!g.xlock.box || !carried(g.xlock.box)))
reset_pick();
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkobj.c $NHDT-Date: 1547086532 2019/01/10 02:15:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.141 $ */
/* NetHack 3.6 mkobj.c $NHDT-Date: 1548978605 2019/01/31 23:50:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.142 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2076,6 +2076,10 @@ struct obj *obj;
if (obj->where != OBJ_FREE)
panic("add_to_migration: obj not free");
/* lock picking context becomes stale if it's for this object */
if (Is_container(obj))
maybe_reset_pick(obj);
obj->where = OBJ_MIGRATING;
obj->nobj = g.migrating_objs;
g.migrating_objs = obj;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1548208236 2019/01/23 01:50:36 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.277 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1548937318 2019/01/31 12:21:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.278 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2211,6 +2211,7 @@ struct monst *mdef;
otmp = oname(otmp, MNAME(mdef));
while ((obj = oldminvent) != 0) {
oldminvent = obj->nobj;
obj->nobj = 0; /* avoid merged-> obfree-> dealloc_obj-> panic */
(void) add_to_container(otmp, obj);
}
/* Archeologists should not break unique statues */

View File

@@ -3291,8 +3291,10 @@ boolean tinitial, tfrom_file;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
return FALSE;
}
if (!assign_videocolors(opts)) /* TODO: error msg */
if (!assign_videocolors(opts)) {
config_error_add("Unknown error handling '%s'", fullname);
return FALSE;
}
return retval;
}
/* videoshades:string */
@@ -3306,8 +3308,10 @@ boolean tinitial, tfrom_file;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
return FALSE;
}
if (!assign_videoshades(opts)) /* TODO: error msg */
if (!assign_videoshades(opts)) {
config_error_add("Unknown error handling '%s'", fullname);
return FALSE;
}
return retval;
}
#endif /* VIDEOSHADES */
@@ -3324,8 +3328,10 @@ boolean tinitial, tfrom_file;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
return FALSE;
}
if (!assign_video(opts)) /* TODO: error msg */
if (!assign_video(opts)) {
config_error_add("Unknown error handling '%s'", fullname);
return FALSE;
}
return retval;
}
#endif /* NO_TERMS */
@@ -3340,8 +3346,10 @@ boolean tinitial, tfrom_file;
} else if (!(opts = string_for_env_opt(fullname, opts, FALSE))) {
return FALSE;
}
if (!assign_soundcard(opts)) /* TODO: error msg */
if (!assign_soundcard(opts)) {
config_error_add("Unknown error handling '%s'", fullname);
return FALSE;
}
return retval;
}
#endif /* MSDOS */
@@ -3565,10 +3573,14 @@ boolean tinitial, tfrom_file;
if (duplicate)
complain_about_duplicate(opts, 1);
if ((op = string_for_opt(opts, FALSE)) != 0) {
if (!wc_set_window_colors(op)) /* TODO: error msg*/
if (!wc_set_window_colors(op)) {
config_error_add("Could not set %s '%s'", fullname, op);
return FALSE;
} else if (negated)
}
} else if (negated) {
bad_negation(fullname, TRUE);
return FALSE;
}
return retval;
}
#ifdef CURSES_GRAPHICS
@@ -3578,8 +3590,10 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, fullname, sizeof "term_cols" - 1, TRUE)) {
op = string_for_opt(opts, negated);
iflags.wc2_term_cols = atoi(op);
if (negated)
bad_negation(fullname, FALSE);
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
}
return retval;
}
@@ -3589,8 +3603,10 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, fullname, sizeof "term_rows" - 1, TRUE)) {
op = string_for_opt(opts, negated);
iflags.wc2_term_rows = atoi(op);
if (negated)
if (negated) {
bad_negation(fullname, FALSE);
return FALSE;
}
return retval;
}
@@ -3602,16 +3618,20 @@ boolean tinitial, tfrom_file;
if (op && !negated) {
#ifdef CURSES_GRAPHICS
iflags.wc2_petattr = curses_read_attrs(op);
if (!curses_read_attrs(op))
if (!curses_read_attrs(op)) {
config_error_add("Unknown %s parameter '%s'", fullname, opts);
return FALSE;
}
#else
/* non-curses windowports will not use this flag anyway
* but the above will not compile if we don't have curses.
* Just set it to a sensible default: */
iflags.wc2_petattr = ATR_INVERSE
#endif
} else if (negated) bad_negation(fullname, TRUE);
} else if (negated) {
bad_negation(fullname, TRUE);
return FALSE;
}
return retval;
}
@@ -3620,9 +3640,10 @@ boolean tinitial, tfrom_file;
fullname = "windowborders";
if (match_optname(opts, fullname, sizeof "windowborders" - 1, TRUE)) {
op = string_for_opt(opts, negated);
if (negated && op)
if (negated && op) {
bad_negation(fullname, TRUE);
else {
return FALSE;
} else {
if (negated)
iflags.wc2_windowborders = 2; /* Off */
else if (!op)
@@ -3633,6 +3654,7 @@ boolean tinitial, tfrom_file;
|| (iflags.wc2_windowborders < 1)) {
iflags.wc2_windowborders = 0;
config_error_add("Badoption - windowborders %s.", opts);
return FALSE;
}
}
return retval;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 shk.c $NHDT-Date: 1547849604 2019/01/18 22:13:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.153 $ */
/* NetHack 3.6 shk.c $NHDT-Date: 1548978606 2019/01/31 23:50:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.154 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -911,6 +911,8 @@ register struct obj *obj, *merge;
book_disappears(obj);
if (Has_contents(obj))
delete_contents(obj);
if (Is_container(obj))
maybe_reset_pick(obj);
shkp = 0;
if (obj->unpaid) {