]> granicus.if.org Git - nethack/commitdiff
fix B18011 warning loss
authornethack.allison <nethack.allison>
Sun, 9 Feb 2003 00:36:33 +0000 (00:36 +0000)
committernethack.allison <nethack.allison>
Sun, 9 Feb 2003 00:36:33 +0000 (00:36 +0000)
> If you remove a ring of warning, see_monsters() is called to make
> sure that the numbers get removed from the display. However, if
> your only source of warning is experience level and you get
> drained and feel "less sensitive", it isn't, and they're not.

doc/fixes34.1
src/attrib.c

index 0777903f4c55604419bd20ef80013a284997a34b..948726e8ba11ffb2eee351b466c9ad2ee0bb837f 100644 (file)
@@ -374,6 +374,8 @@ using travel mode to move next to a known trap and then trying to step onto
        that trap required an extra step; the first one ended up as a no-op
 punished with ball and chain on the same floor square as a trapped chest
        when it exploded resulted in panic "remove_object: obj not on floor"
+see_monsters() wasn't called when you lost the innate warning intrinsic due
+       to level loss
 
 
 Platform- and/or Interface-Specific Fixes
index 12945c57b267e24174da93f57dd4a0fa580bf79f..e13f8300707216431f7d0a66f5d88c2c8357dc0b 100644 (file)
@@ -98,6 +98,7 @@ const struct innate {
 
 static long next_check = 600L; /* arbitrary first setting */
 STATIC_DCL void NDECL(exerper);
+STATIC_DCL void FDECL(postadjabil, (long *));
 
 /* adjust an attribute; return TRUE if change is made, FALSE otherwise */
 boolean
@@ -521,6 +522,15 @@ redist_attr()
        (void)encumber_msg();
 }
 
+void
+postadjabil(ability)
+long *ability;
+{
+       if (!ability) return;
+       if (ability == &(HWarning) || ability == &(HSee_invisible))
+               see_monsters();
+}
+
 void
 adjabil(oldlevel,newlevel)
 int oldlevel, newlevel;
@@ -558,6 +568,7 @@ int oldlevel, newlevel;
        }
 
        while (abil || rabil) {
+           long prevabil;
            /* Have we finished with the intrinsics list? */
            if (!abil || !abil->ability) {
                /* Try the race intrinsics */
@@ -566,7 +577,7 @@ int oldlevel, newlevel;
                rabil = 0;
                mask = FROMRACE;
            }
-
+               prevabil = *(abil->ability);
                if(oldlevel < abil->ulevel && newlevel >= abil->ulevel) {
                        /* Abilities gained at level 1 can never be lost
                         * via level loss, only via means that remove _any_
@@ -591,6 +602,8 @@ int oldlevel, newlevel;
                                You_feel("less %s!", abil->gainstr);
                        }
                }
+           if (prevabil != *(abil->ability))   /* it changed */
+               postadjabil(abil->ability);
            abil++;
        }