more #H8167 - late messages

Do late message suppression in a different fashion.  Also, there are
more messages than shk taking hero's possessions and guard taking
hero's gold that need to be suppressed if regular message delivery
is no longer possible:  "do not pass Go", "you arise from the grave
as a foo", "the corridor disappears", "you are encased in the rock".
Those last two are from vault handling but take place in a convoluted
manner:  paygd -> mongone -> grddead -> clear_fcorr.
This commit is contained in:
PatR
2019-02-11 13:39:34 -08:00
parent 684fee0f64
commit 4bb5560961
4 changed files with 45 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1549157811 2019/02/03 01:36:51 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.692 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1549921169 2019/02/11 21:39:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.693 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2222,7 +2222,7 @@ E void FDECL(make_happy_shoppers, (BOOLEAN_P));
E void FDECL(hot_pursuit, (struct monst *));
E void FDECL(make_angry_shk, (struct monst *, XCHAR_P, XCHAR_P));
E int NDECL(dopay);
E boolean FDECL(paybill, (int));
E boolean FDECL(paybill, (int, BOOLEAN_P));
E void NDECL(finish_paybill);
E struct obj *FDECL(find_oid, (unsigned));
E long FDECL(contained_cost,
@@ -2592,7 +2592,7 @@ E char FDECL(vault_occupied, (char *));
E void FDECL(uleftvault, (struct monst *));
E void NDECL(invault);
E int FDECL(gd_move, (struct monst *));
E void NDECL(paygd);
E void FDECL(paygd, (BOOLEAN_P));
E long NDECL(hidden_gold);
E boolean NDECL(gd_sound);
E void FDECL(vault_gd_watching, (unsigned int));

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. */
@@ -1149,6 +1149,10 @@ int how;
program_state.gameover = 1;
/* in case of a subsequent panic(), there's no point trying to save */
program_state.something_worth_saving = 0;
#ifdef HANGUPHANDLING
if (program_state.done_hup)
done_stopprint++;
#endif
/* render vision subsystem inoperative */
iflags.vision_inited = 0;
@@ -1173,8 +1177,8 @@ int how;
* On those rare occasions you get hosed immediately, go out
* smiling... :-) -3.
*/
if (moves <= 1 && how < PANICKED) /* You die... --More-- */
pline("Do not pass go. Do not collect 200 %s.", currency(200L));
if (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 */
@@ -1220,9 +1224,11 @@ int how;
fixup_death(how); /* actually, fixup 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 ); */
@@ -1329,7 +1335,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. */
@@ -56,7 +56,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 *));
@@ -1686,8 +1686,9 @@ static struct repo { /* repossession context */
/* 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;
@@ -1752,7 +1753,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 */
@@ -1763,7 +1764,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)
@@ -1773,23 +1774,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 */
@@ -1797,7 +1795,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),
@@ -1817,7 +1815,7 @@ int croaked;
&& !eshkp->robbed && !eshkp->debit && NOTANGRY(shkp)
&& !eshkp->following && u.ugrave_arise < LOW_PM) {
taken = (invent != 0);
if (taken && verbose)
if (taken && !silently)
pline("%s gratefully inherits all your possessions.",
Shknam(shkp));
set_repo_loc(shkp);
@@ -1851,7 +1849,7 @@ int croaked;
money2mon(shkp, umoney);
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) */
@@ -1859,7 +1857,7 @@ int croaked;
} else {
money2mon(shkp, loss);
context.botl = 1;
if (verbose)
if (!silently)
pline("%s %s the %ld %s %sowed %s.", Shknam(shkp),
takes, loss, currency(loss),
strncmp(eshkp->customer, 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 = program_state.stopprint ? TRUE : FALSE;
struct egd *egrd = EGD(grd);
struct trap *trap;
struct rm *lev;
@@ -101,11 +102,13 @@ boolean forceshow;
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(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 = rooms[EGD(grd)->vroom].lx + rn2(2);
gy = rooms[EGD(grd)->vroom].ly + rn2(2);
@@ -1105,7 +1103,9 @@ paygd()
stackobj(coins);
}
}
remove_guard:
mongone(grd);
return;
}
long