]> granicus.if.org Git - nethack/commitdiff
fix #Q221 - inappropriate vault guard message when embedded gold reached
authornethack.rankin <nethack.rankin>
Sat, 12 Nov 2005 03:19:22 +0000 (03:19 +0000)
committernethack.rankin <nethack.rankin>
Sat, 12 Nov 2005 03:19:22 +0000 (03:19 +0000)
     From a bug report:  when a guard who's
leading the character out of a vault comes across gold (from mineralize()
usually, but a player could deliberately seed the area in xorn form), the
message "the guard calms down and picks up the gold" was given even though
the guard wasn't angry.  Pick up such gold as soon as temporary corridor
reaches it so that on his next move the guard won't mistakenly think that
the hero has just dropped it.

doc/fixes34.4
src/vault.c

index 681a7637f1275c848ef484dc6dd1a2ff50a5b43e..536822cbcb8b737d96e332fec44f7ddfe4d23f1f 100644 (file)
@@ -152,6 +152,8 @@ incubi react to mirrors
 alignment of Angels was handled inconsistently
 pets capable of digging could pass through walls and stone on the Rogue level
 avoid inappropriate "the corridor disappears" when vault guard gets killed
+avoid inappropriate "the guard calms down" if vault guard's magic corridor
+       reaches a spot where gold is embedded in the rock
 adjust message for gas effect from chest trap if hero resists hallucination
 
 
index a65c2d7b048dc426124a68f1278055315c8e94c9..2cce55a0bc79f6372fe338859ad2732b8e98251a 100644 (file)
@@ -454,7 +454,7 @@ register struct monst *grd;
         long umoney = money_cnt(invent);
        register boolean u_carry_gold = ((umoney + hidden_gold()) > 0L);
 #endif
-       boolean see_guard;
+       boolean see_guard, newspot = FALSE;
 
        if(!on_level(&(egrd->gdlevel), &u.uz)) return(-1);
        nx = ny = m = n = 0;
@@ -695,6 +695,7 @@ nextpos:
        }
        crm->typ = CORR;
 proceed:
+       newspot = TRUE;
        unblock_point(nx, ny);  /* doesn't block light */
        if (cansee(nx,ny))
            newsym(nx,ny);
@@ -738,7 +739,14 @@ cleanup:
        egrd->ogy = grd->my;
        remove_monster(grd->mx, grd->my);
        place_monster(grd, nx, ny);
-       newsym(grd->mx,grd->my);
+       if (newspot && g_at(nx, ny)) {
+           /* if there's gold already here (most likely from mineralize()),
+              pick it up now so that guard doesn't later think hero dropped
+              it and give an inappropriate message */
+           mpickgold(grd);
+           if (canspotmon(grd)) pline("%s picks up some gold.", Monnam(grd));
+       } else
+           newsym(grd->mx, grd->my);
        restfakecorr(grd);
        return(1);
 }