From ecb98e019c4b90d42b652f232e34f721acd44977 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Sun, 26 Mar 2006 05:23:46 +0000 Subject: [PATCH] eating gold in front of the vault guard (trunk only) wrote: > Eating gold in a vault (or polymorphing a pile of gold into 1 gold piece) > doesn't anger the guard. This addresses the eating part of that report, but the hero has to get caught doing it. --- doc/fixes35.0 | 1 + include/extern.h | 1 + include/mextra.h | 5 ++++- src/eat.c | 1 + src/vault.c | 19 +++++++++++++++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 0341bea39..b66e6ee8e 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -130,6 +130,7 @@ doors break instead of absorbing the blast of a broken wand of striking avoid "Something's in the way" message with unidentified wand of locking better handling for Fort Ludios and endgame in wizard mode's `^V ?' menu no free lunch for gelatinous cubes eating scrolls of mail +eating gold in front of the vault guard will make the guard angry Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index bb23cbafa..f7bc8d887 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2236,6 +2236,7 @@ E int FDECL(gd_move, (struct monst *)); E void NDECL(paygd); E long NDECL(hidden_gold); E boolean NDECL(gd_sound); +E void FDECL(vault_gd_watching, (unsigned int)); /* ### version.c ### */ diff --git a/include/mextra.h b/include/mextra.h index def2fdc5f..6e0eb71ef 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -62,6 +62,8 @@ ** formerly vault.h -- vault guard extension */ #define FCSIZ (ROWNO+COLNO) +#define GD_EATGOLD 0x01 +#define GD_DESTROYGOLD 0x02 struct fakecorridor { xchar fx, fy, ftyp; @@ -75,7 +77,8 @@ struct egd { d_level gdlevel; /* level (& dungeon) guard was created in */ xchar warncnt; /* number of warnings to follow */ Bitfield(gddone,1); /* true iff guard has released player */ - Bitfield(unused,7); + Bitfield(witness,2); /* the guard saw you do something */ + Bitfield(unused,5); struct fakecorridor fakecorr[FCSIZ]; }; diff --git a/src/eat.c b/src/eat.c index 15a4174c7..dc5d96723 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1900,6 +1900,7 @@ eatspecial() /* called after eating non-food */ #endif else useupf(otmp, otmp->quan); + vault_gd_watching(GD_EATGOLD); return; } #ifdef MAIL diff --git a/src/vault.c b/src/vault.c index 77994ef1f..415139448 100644 --- a/src/vault.c +++ b/src/vault.c @@ -510,6 +510,14 @@ register struct monst *grd; if(abs(egrd->ogx - grd->mx) > 1 || abs(egrd->ogy - grd->my) > 1) return(-1); /* teleported guard - treat as monster */ + + if(egrd->witness) { + verbalize("How dare you %s that gold, scoundrel!", + (egrd->witness & GD_EATGOLD) ? "consume" : "destroy"); + egrd->witness = 0; + grd->mpeaceful = 0; + return(-1); + } if(egrd->fcend == 1) { if(u_in_vault && (u_carry_gold || um_dist(grd->mx, grd->my, 1))) { @@ -864,4 +872,15 @@ gd_sound() /* prevent "You hear footsteps.." when inappropriate */ else return((boolean)(grd == (struct monst *)0)); } +void +vault_gd_watching(activity) +unsigned int activity; +{ + struct monst *guard = findgd(); + if (guard && guard->mcansee && m_canseeu(guard)) { + if (activity == GD_EATGOLD || + activity == GD_DESTROYGOLD) + EGD(guard)->witness = activity; + } +} /*vault.c*/ -- 2.40.0