]> granicus.if.org Git - nethack/commitdiff
fix #Q211 - inappropriate vault feedback
authornethack.rankin <nethack.rankin>
Sat, 29 Oct 2005 04:07:21 +0000 (04:07 +0000)
committernethack.rankin <nethack.rankin>
Sat, 29 Oct 2005 04:07:21 +0000 (04:07 +0000)
     From a bug report, you'd get the message
"the corridor disappears" whenever a vault guard was killed, even if the
temporary vault corridor was already gone due to leaving its vicinity.  This
fix seems to work ok, but I don't pretend to understand how the convoluted
vault code actually works.

doc/fixes34.4
src/vault.c

index a5b327a7e75afb67779cc94b461ef3c69c5617ee..f988bdaa8afdaa68b58347536a3de937284f9788 100644 (file)
@@ -151,6 +151,7 @@ some messages which referred to "mirror" ought to have used "looking glass"
 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
 
 
 Platform- and/or Interface-Specific Fixes
index 44eef73222f87f6d3e6f19e144f021f4f83db2f1..a65c2d7b048dc426124a68f1278055315c8e94c9 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)vault.c    3.5     2003/01/15      */
+/*     SCCS Id: @(#)vault.c    3.5     2005/10/28      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -18,19 +18,21 @@ STATIC_DCL void FDECL(wallify_vault,(struct monst *));
 
 STATIC_OVL boolean
 clear_fcorr(grd, forceshow)
-register struct monst *grd;
-register boolean forceshow;
+struct monst *grd;
+boolean forceshow;
 {
        register int fcx, fcy, fcbeg;
-       register struct monst *mtmp;
+       struct monst *mtmp;
+       boolean sawcorridor = FALSE;
+       struct egd *egrd = EGD(grd);
 
-       if (!on_level(&(EGD(grd)->gdlevel), &u.uz)) return TRUE;
+       if (!on_level(&egrd->gdlevel, &u.uz)) return TRUE;
 
-       while((fcbeg = EGD(grd)->fcbeg) < EGD(grd)->fcend) {
-               fcx = EGD(grd)->fakecorr[fcbeg].fx;
-               fcy = EGD(grd)->fakecorr[fcbeg].fy;
+       while ((fcbeg = egrd->fcbeg) < egrd->fcend) {
+               fcx = egrd->fakecorr[fcbeg].fx;
+               fcy = egrd->fakecorr[fcbeg].fy;
                if((grd->mhp <= 0 || !in_fcorridor(grd, u.ux, u.uy)) &&
-                                  EGD(grd)->gddone)
+                           egrd->gddone)
                        forceshow = TRUE;
                if((u.ux == fcx && u.uy == fcy && grd->mhp > 0)
                        || (!forceshow && couldsee(fcx,fcy))
@@ -45,12 +47,14 @@ register boolean forceshow;
                            (void) rloc(mtmp, FALSE);
                        }
                }
-               levl[fcx][fcy].typ = EGD(grd)->fakecorr[fcbeg].ftyp;
+               if (levl[fcx][fcy].typ == CORR && cansee(fcx, fcy))
+                   sawcorridor = TRUE;
+               levl[fcx][fcy].typ = egrd->fakecorr[fcbeg].ftyp;
                map_location(fcx, fcy, 1);      /* bypass vision */
                if(!ACCESSIBLE(levl[fcx][fcy].typ)) block_point(fcx,fcy);
-               EGD(grd)->fcbeg++;
+               egrd->fcbeg++;
        }
-       if(grd->mhp <= 0) {
+       if (sawcorridor) {
            pline_The("corridor disappears.");
            if(IS_ROCK(levl[u.ux][u.uy].typ)) You("are encased in rock.");
        }