stale spellbook pointer

If you get interrupted while reading a spellbook and then
the book gets destroyed or you change levels, the object pointer
remembered for the book will be invalid and could accidentally
match one subsequently allocated to some other book.  That would
result in "you continue your efforts to memorize the spell" when
starting to read that other book; it would also end up bypassing
the reading difficulty check and reuse the old book's delay counter.

     I don't remember who reported this.  It was quite some time
ago and I have an abandoned patch dated last March from when I
first started to fix it.

Files patched:
  include/extern.h
  src/save.c, shk.c, spell.c
This commit is contained in:
nethack.rankin
2002-01-20 09:53:36 +00:00
parent 36511f2280
commit e2175c2ce1
5 changed files with 18 additions and 6 deletions

View File

@@ -1808,6 +1808,7 @@ E boolean FDECL(load_special, (const char *));
E int NDECL(learn);
#endif
E int FDECL(study_book, (struct obj *));
E void FDECL(book_disappears, (struct obj *));
E void FDECL(book_substitution, (struct obj *,struct obj *));
E void NDECL(age_spells);
E int NDECL(docast);