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.
This commit is contained in:
PatR
2021-08-18 17:40:09 -07:00
parent f74121d1ce
commit 35831023b1
2 changed files with 9 additions and 5 deletions

View 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

View 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 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