fix #H3734 - "see an angry guard" when that guard

is invisible and hero can't see him/her.  Reported for 3.4.3 in
late 2014....
This commit is contained in:
PatR
2021-02-23 02:04:21 -08:00
parent ed349cd5fe
commit 27a0351cd2
2 changed files with 26 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.460 $ $NHDT-Date: 1613957400 2021/02/22 01:30:00 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.461 $ $NHDT-Date: 1614074653 2021/02/23 10:04:13 $
General Fixes and Modified Features
-----------------------------------
@@ -384,6 +384,8 @@ curses interface failed to honor menu_xxx option settings for menu interaction
during engraving, spaces were counted instead of non-spaces
when an explosion scatters objects, make any that fly over sinks stop there
output message when changing fastmove mode while cursor targetting
messages when Minetown watchmen become angry could report "you see an angry
guard approaching" even if he was invisible and hero can't see invis
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mon.c $NHDT-Date: 1609281168 2020/12/29 22:32:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.364 $ */
/* NetHack 3.7 mon.c $NHDT-Date: 1614074654 2021/02/23 10:04:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.370 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -4505,6 +4505,7 @@ golemeffects(register struct monst* mon, int damtype, int dam)
}
}
/* anger the Minetown watch */
boolean
angry_guards(boolean silent)
{
@@ -4516,8 +4517,8 @@ angry_guards(boolean silent)
continue;
if (is_watch(mtmp->data) && mtmp->mpeaceful) {
ct++;
if (cansee(mtmp->mx, mtmp->my) && mtmp->mcanmove) {
if (distu(mtmp->mx, mtmp->my) == 2)
if (canspotmon(mtmp) && mtmp->mcanmove) {
if (distu(mtmp->mx, mtmp->my) <= 2)
nct++;
else
sct++;
@@ -4531,18 +4532,25 @@ angry_guards(boolean silent)
}
if (ct) {
if (!silent) { /* do we want pline msgs? */
if (slct)
pline_The("guard%s wake%s up!", slct > 1 ? "s" : "",
slct == 1 ? "s" : "");
if (nct || sct) {
if (nct)
pline_The("guard%s get%s angry!", nct == 1 ? "" : "s",
nct == 1 ? "s" : "");
else if (!Blind)
You_see("%sangry guard%s approaching!",
sct == 1 ? "an " : "", sct > 1 ? "s" : "");
} else
You_hear("the shrill sound of a guard's whistle.");
char buf[BUFSZ];
if (slct) { /* sleeping guard(s) */
Sprintf(buf, "guard%s", plur(slct));
pline_The("%s %s up.", buf, vtense(buf, "wake"));
}
if (nct) { /* seen/sensed adjacent guard(s) */
Sprintf(buf, "guard%s", plur(nct));
pline_The("%s %s angry!", buf, vtense(buf, "get"));
} else if (sct) { /* seen/sensed non-adjcent guard(s) */
Sprintf(buf, "guard%s", plur(sct));
pline("%s %s %s approaching!",
(sct == 1) ? "An angry" : "Angry",
buf, vtense(buf, "are"));
} else {
Strcpy(buf, (ct == 1) ? "a guard's" : "guards'");
You_hear("the shrill sound of %s whistle%s.", buf, plur(ct));
}
}
return TRUE;
}