From: PatR Date: Thu, 19 Aug 2021 00:40:09 +0000 (-0700) Subject: when spellbook being read becomes cursed X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35831023b17b71efb2daebec349321813bf1a4e3;p=nethack when spellbook being read becomes cursed 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. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index acf4414b7..8ab7e130a 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 slams shut!" and set book->bknown Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/spell.c b/src/spell.c index 870f7f552..34db93453 100644 --- a/src/spell.c +++ b/src/spell.c @@ -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 obj* book) +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