]> granicus.if.org Git - nethack/commitdiff
eating gold in front of the vault guard (trunk only)
authornethack.allison <nethack.allison>
Sun, 26 Mar 2006 05:23:46 +0000 (05:23 +0000)
committernethack.allison <nethack.allison>
Sun, 26 Mar 2006 05:23:46 +0000 (05:23 +0000)
<email deleted> 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
include/extern.h
include/mextra.h
src/eat.c
src/vault.c

index 0341bea3946ebbe9f942104fb0a178cb0d3eb2e0..b66e6ee8e6a93963cbbd4d36d0475d005c2ccbbd 100644 (file)
@@ -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
index bb23cbafa4f64b93ba4650825c61554ef8a6f276..f7bc8d88762547334796f47bc67c5fd93c5b3ecc 100644 (file)
@@ -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 ### */
 
index def2fdc5f17242d53de96053a16be803bd4dbe7a..6e0eb71efd3c2fbc9395899c47407b2a019ff3d7 100644 (file)
@@ -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];
 };
 
index 15a4174c71defe088f6883928fe07ac20537900e..dc5d9672314a300358c6520ef6e5c33a450941d3 100644 (file)
--- 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
index 77994ef1fc25381b8f10aa32068491ce00c0837e..415139448af3c9e001a5137becf06362ef235690 100644 (file)
@@ -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*/