Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-02-13 15:09:02 -05:00
9 changed files with 126 additions and 98 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_wear.c $NHDT-Date: 1549758452 2019/02/10 00:27:32 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.106 $ */
/* NetHack 3.6 do_wear.c $NHDT-Date: 1550014802 2019/02/12 23:40:02 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.107 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1205,7 +1205,7 @@ struct obj *otmp;
{
boolean result = FALSE;
/* 'W' (or 'P' used for armor) sets afternmv */
/* 'W' (or 'P' used for armor) sets g.afternmv */
if (doffing(otmp))
result = TRUE;
else if (otmp == uarm)
@@ -1235,7 +1235,7 @@ struct obj *otmp;
long what = g.context.takeoff.what;
boolean result = FALSE;
/* 'T' (or 'R' used for armor) sets afternmv, 'A' sets takeoff.what */
/* 'T' (or 'R' used for armor) sets g.afternmv, 'A' sets takeoff.what */
if (otmp == uarm)
result = (g.afternmv == Armor_off || what == WORN_ARMOR);
else if (otmp == uarmu)
@@ -1250,7 +1250,7 @@ struct obj *otmp;
result = (g.afternmv == Gloves_off || what == WORN_GLOVES);
else if (otmp == uarms)
result = (g.afternmv == Shield_off || what == WORN_SHIELD);
/* these 1-turn items don't need 'afternmv' checks */
/* these 1-turn items don't need 'g.afternmv' checks */
else if (otmp == uamul)
result = (what == WORN_AMUL);
else if (otmp == uleft)
@@ -1924,26 +1924,31 @@ struct obj *obj;
obj->known = 1;
*/
setworn(obj, mask);
/* if there's no delay, we'll execute 'aftermv' immediately */
if (obj == uarm)
g.afternmv = Armor_on;
else if (obj == uarmh)
g.afternmv = Helmet_on;
else if (obj == uarmg)
g.afternmv = Gloves_on;
else if (obj == uarmf)
g.afternmv = Boots_on;
else if (obj == uarms)
g.afternmv = Shield_on;
else if (obj == uarmc)
g.afternmv = Cloak_on;
else if (obj == uarmu)
g.afternmv = Shirt_on;
else
panic("wearing armor not worn as armor? [%08lx]", obj->owornmask);
delay = -objects[obj->otyp].oc_delay;
if (delay) {
nomul(delay);
g.multi_reason = "dressing up";
if (is_boots(obj))
g.afternmv = Boots_on;
if (is_helmet(obj))
g.afternmv = Helmet_on;
if (is_gloves(obj))
g.afternmv = Gloves_on;
if (obj == uarm)
g.afternmv = Armor_on;
g.nomovemsg = "You finish your dressing maneuver.";
} else {
if (is_cloak(obj))
(void) Cloak_on();
if (is_shield(obj))
(void) Shield_on();
if (is_shirt(obj))
(void) Shirt_on();
unmul(""); /* call (*g.aftermv)(), clear it+g.nomovemsg+g.multi_reason */
on_msg(obj);
}
g.context.takeoff.mask = g.context.takeoff.what = 0L;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 end.c $NHDT-Date: 1545786454 2018/12/26 01:07:34 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.162 $ */
/* NetHack 3.6 end.c $NHDT-Date: 1549921169 2019/02/11 21:39:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.163 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1126,6 +1126,10 @@ int how;
g.program_state.gameover = 1;
/* in case of a subsequent panic(), there's no point trying to save */
g.program_state.something_worth_saving = 0;
#ifdef HANGUPHANDLING
if (g.program_state.done_hup)
done_stopprint++;
#endif
/* render vision subsystem inoperative */
iflags.vision_inited = 0;
@@ -1150,8 +1154,8 @@ int how;
* On those rare occasions you get hosed immediately, go out
* smiling... :-) -3.
*/
if (g.moves <= 1 && how < PANICKED) /* You die... --More-- */
pline("Do not pass go. Do not collect 200 %s.", currency(200L));
if (g.moves <= 1 && how < PANICKED && !done_stopprint)
pline("Do not pass Go. Do not collect 200 %s.", currency(200L));
if (have_windows)
wait_synch(); /* flush screen output */
@@ -1197,9 +1201,11 @@ int how;
fixup_death(how); /* actually, fixup g.multi_reason */
if (how != PANICKED) {
boolean silently = done_stopprint ? TRUE : FALSE;
/* these affect score and/or bones, but avoid them during panic */
taken = paybill((how == ESCAPED) ? -1 : (how != QUIT));
paygd();
taken = paybill((how == ESCAPED) ? -1 : (how != QUIT), silently);
paygd(silently);
clearpriests();
} else
taken = FALSE; /* lint; assert( !bones_ok ); */
@@ -1306,7 +1312,7 @@ int how;
}
}
if (u.ugrave_arise >= LOW_PM) {
if (u.ugrave_arise >= LOW_PM && !done_stopprint) {
/* give this feedback even if bones aren't going to be created,
so that its presence or absence doesn't tip off the player to
new bones or their lack; it might be a lie if makemon fails */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 shk.c $NHDT-Date: 1549849510 2019/02/11 01:45:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.155 $ */
/* NetHack 3.6 shk.c $NHDT-Date: 1549921170 2019/02/11 21:39:30 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.156 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -55,7 +55,7 @@ STATIC_DCL long FDECL(getprice, (struct obj *, BOOLEAN_P));
STATIC_DCL void FDECL(shk_names_obj, (struct monst *, struct obj *,
const char *, long, const char *));
STATIC_DCL struct obj *FDECL(bp_to_obj, (struct bill_x *));
STATIC_DCL boolean FDECL(inherits, (struct monst *, int, int));
STATIC_DCL boolean FDECL(inherits, (struct monst *, int, int, BOOLEAN_P));
STATIC_DCL void FDECL(set_repo_loc, (struct monst *));
STATIC_DCL boolean NDECL(angry_shk_exists);
STATIC_DCL void FDECL(rile_shk, (struct monst *));
@@ -1680,8 +1680,9 @@ boolean itemize;
/* routine called after dying (or quitting) */
boolean
paybill(croaked)
paybill(croaked, silently)
int croaked; /* -1: escaped dungeon; 0: quit; 1: died */
boolean silently; /* maybe avoid messages */
{
struct monst *mtmp, *mtmp2, *firstshk, *resident, *creditor, *hostile,
*localshk;
@@ -1746,7 +1747,7 @@ int croaked; /* -1: escaped dungeon; 0: quit; 1: died */
: localshk;
if (firstshk) {
numsk++;
taken = inherits(firstshk, numsk, croaked);
taken = inherits(firstshk, numsk, croaked, silently);
}
/* now handle the rest */
@@ -1757,7 +1758,7 @@ int croaked; /* -1: escaped dungeon; 0: quit; 1: died */
local = on_level(&eshkp->shoplevel, &u.uz);
if (mtmp != firstshk) {
numsk++;
taken |= inherits(mtmp, numsk, croaked);
taken |= inherits(mtmp, numsk, croaked, silently);
}
/* for bones: we don't want a shopless shk around */
if (!local)
@@ -1767,23 +1768,20 @@ int croaked; /* -1: escaped dungeon; 0: quit; 1: died */
}
STATIC_OVL boolean
inherits(shkp, numsk, croaked)
inherits(shkp, numsk, croaked, silently)
struct monst *shkp;
int numsk;
int croaked;
boolean silently;
{
long loss = 0L;
long umoney;
struct eshk *eshkp = ESHK(shkp);
boolean take = FALSE, taken = FALSE, verbose;
boolean take = FALSE, taken = FALSE;
unsigned save_minvis = shkp->minvis;
int roomno = *u.ushops;
char takes[BUFSZ];
verbose = !program_state.stopprint;
#ifdef HANGUPHANDLING
verbose &= !program_state.done_hup;
#endif
/* not strictly consistent; affects messages and prevents next player
(if bones are saved) from blundering into or being ambused by an
invisible shopkeeper */
@@ -1791,7 +1789,7 @@ int croaked;
/* The simplifying principle is that first-come
already took everything you had. */
if (numsk > 1) {
if (verbose && cansee(shkp->mx, shkp->my) && croaked) {
if (cansee(shkp->mx, shkp->my) && croaked && !silently) {
takes[0] = '\0';
if (has_head(shkp->data) && !rn2(2))
Sprintf(takes, ", shakes %s %s,", noit_mhis(shkp),
@@ -1811,7 +1809,7 @@ int croaked;
&& !eshkp->robbed && !eshkp->debit && NOTANGRY(shkp)
&& !eshkp->following && u.ugrave_arise < LOW_PM) {
taken = (g.invent != 0);
if (taken && verbose)
if (taken && !silently)
pline("%s gratefully inherits all your possessions.",
Shknam(shkp));
set_repo_loc(shkp);
@@ -1845,7 +1843,7 @@ int croaked;
money2mon(shkp, umoney);
g.context.botl = 1;
}
if (verbose)
if (!silently)
pline("%s %s all your possessions.", Shknam(shkp), takes);
taken = TRUE;
/* where to put player's invent (after disclosure) */
@@ -1853,7 +1851,7 @@ int croaked;
} else {
money2mon(shkp, loss);
g.context.botl = 1;
if (verbose)
if (!silently)
pline("%s %s the %ld %s %sowed %s.", Shknam(shkp),
takes, loss, currency(loss),
strncmp(eshkp->customer, g.plname, PL_NSIZ) ? "" : "you ",

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 vault.c $NHDT-Date: 1549849513 2019/02/11 01:45:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.61 $ */
/* NetHack 3.6 vault.c $NHDT-Date: 1549921171 2019/02/11 21:39:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.62 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -49,7 +49,8 @@ boolean forceshow;
{
register int fcx, fcy, fcbeg;
struct monst *mtmp;
boolean sawcorridor = FALSE;
boolean sawcorridor = FALSE,
silently = g.program_state.stopprint ? TRUE : FALSE;
struct egd *egrd = EGD(grd);
struct trap *trap;
struct rm *lev;
@@ -101,11 +102,13 @@ boolean forceshow;
g.vision_full_recalc = 1;
egrd->fcbeg++;
}
if (sawcorridor)
if (sawcorridor && !silently)
pline_The("corridor disappears.");
/* only give encased message if hero is still alive (might get here
via paygd() when game is over; died: no message, quit: message) */
if (IS_ROCK(levl[u.ux][u.uy].typ) && (Upolyd ? u.mh : u.uhp) > 0)
via paygd() -> mongone() -> grddead() when game is over;
died: no message, quit: message) */
if (IS_ROCK(levl[u.ux][u.uy].typ) && (Upolyd ? u.mh : u.uhp) > 0
&& !silently)
You("are encased in rock.");
return TRUE;
}
@@ -1061,35 +1064,30 @@ register struct monst *grd;
/* Routine when dying or quitting with a vault guard around */
void
paygd()
paygd(silently)
boolean silently;
{
register struct monst *grd = findgd();
long umoney = money_cnt(g.invent);
struct obj *coins, *nextcoins;
int gx, gy;
char buf[BUFSZ];
boolean verbose;
if (!umoney || !grd)
return;
verbose = !program_state.stopprint;
#ifdef HANGUPHANDLING
verbose &= !program_state.done_hup;
#endif
if (u.uinvault) {
if (verbose)
if (!silently)
Your("%ld %s goes into the Magic Memory Vault.",
umoney, currency(umoney));
gx = u.ux;
gy = u.uy;
} else {
if (grd->mpeaceful) { /* guard has no "right" to your gold */
mongone(grd);
return;
}
if (grd->mpeaceful) /* peaceful guard has no "right" to your gold */
goto remove_guard;
mnexto(grd);
if (verbose)
if (!silently)
pline("%s remits your gold to the vault.", Monnam(grd));
gx = g.rooms[EGD(grd)->vroom].lx + rn2(2);
gy = g.rooms[EGD(grd)->vroom].ly + rn2(2);
@@ -1105,7 +1103,9 @@ paygd()
stackobj(coins);
}
}
remove_guard:
mongone(grd);
return;
}
long