]> granicus.if.org Git - nethack/commitdiff
when spellbook being read becomes cursed
authorPatR <rankin@nethack.org>
Thu, 19 Aug 2021 00:40:09 +0000 (17:40 -0700)
committerPatR <rankin@nethack.org>
Thu, 19 Aug 2021 00:40:09 +0000 (17:40 -0700)
Revisit a 3.6.1 fix.  When the hero is occupied reading a spellbook
and something causes it to become cursed without interrupting (post-
Wizard harassment's malignant aura), always stop reading instead of
just when the book's bknown flag is already set.

doc/fixes37.0
src/spell.c

index acf4414b7253c3d2f991272545bdaa33748ce371..8ab7e130a9b266f4ca36a7013ff5cabd3ee1fd9e 100644 (file)
@@ -588,6 +588,8 @@ in wizard mode, polymorphing into hero's role monster in order to revert to
        normal form would complain about missing light source if hero was
        changing back from the form of a light-emitting monster [didn't affect
        normal play because role monsters are invalid polymorph targets there]
+revise a 3.6.1 fix: if a spellbook which is being read becomes cursed, always
+       stop reading: "The <book> slams shut!" and set book->bknown
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 870f7f552eb15db7023d9c85e93ded90abeae9aa..34db93453d7ee1f83461b2796dde6917e06e1c9b 100644 (file)
@@ -327,14 +327,16 @@ deadbook(struct obj* book2)
     return;
 }
 
-/* 'book' has just become cursed; if we're reading it and realize it is
-   now cursed, interrupt */
+/* 'book' has just become cursed; if we're reading it, interrupt */
 void
-book_cursed(struct objbook)
+book_cursed(struct obj *book)
 {
-    if (g.occupation == learn && g.context.spbook.book == book
-        && book->cursed && book->bknown && g.multi >= 0)
+    if (book->cursed && g.multi >= 0
+        && g.occupation == learn && g.context.spbook.book == book) {
+        pline("%s shut!", Tobjnam(book, "slam"));
+        set_bknown(book, 1);
         stop_occupation();
+    }
 }
 
 DISABLE_WARNING_FORMAT_NONLITERAL