From 11e98efb94f302a46f809fbb70dc5bc07a498d26 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 18 May 2021 18:31:04 -0700 Subject: [PATCH] fix pull request #513 - applying books Applying a novel to flip through its pages described them as having "ink" rather than "magical ink" but that wasn't a very suitable way to distinguish them from spellbooks since their ink never fades. The Book of the Dead's pages "glowed faintly red" even when the hero couldn't see them. Fixes #513 --- doc/fixes37.0 | 3 ++- src/apply.c | 32 +++++++++++++++----------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 04d58c1e7..fffcfdf09 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.539 $ $NHDT-Date: 1621380392 2021/05/18 23:26:32 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.540 $ $NHDT-Date: 1621387861 2021/05/19 01:31:01 $ General Fixes and Modified Features ----------------------------------- @@ -681,6 +681,7 @@ forgetting an item's known/dknown/bknown/&c settings when picked up by unseen monster made it possible to trigger a latent shop bug with globs; avoid clearing dknown flag for globs fix globby_bill_fixup to use shopkeeper instead of Null for glob pricing +applying a book to check readability treated novels as if they were spellbooks curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/apply.c b/src/apply.c index cc986a11b..4a149cc3f 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 apply.c $NHDT-Date: 1615158480 2021/03/07 23:08:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.340 $ */ +/* NetHack 3.7 apply.c $NHDT-Date: 1621387861 2021/05/19 01:31:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.344 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3957,45 +3957,43 @@ flip_through_book(struct obj *obj) return 0; } - You("flip through the pages of the spellbook."); + You("flip through the pages of %s.", thesimpleoname(obj)); if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { - if (Deaf) { - You_see("the pages glow faintly %s.", hcolor(NH_RED)); - } else { + if (!Deaf) You_hear("the pages make an unpleasant %s sound.", - Hallucination ? "chuckling" - : "rustling"); - } - return 1; + Hallucination ? "chuckling" + : "rustling"); + else if (!Blind) + You_see("the pages glow faintly %s.", hcolor(NH_RED)); + else + You_feel("the pages tremble."); } else if (Blind) { pline("The pages feel %s.", Hallucination ? "freshly picked" : "rough and dry"); - return 1; } else if (obj->otyp == SPE_BLANK_PAPER) { pline("This spellbook %s.", Hallucination ? "doesn't have much of a plot" : "has nothing written in it"); makeknown(obj->otyp); - return 1; - } - - if (Hallucination) { + } else if (Hallucination) { You("enjoy the animated initials."); + } else if (obj->otyp == SPE_NOVEL) { + pline("This looks like it might be interesting to read."); } else { - static const char* fadeness[] = { + static const char *fadeness[] = { "fresh", "slightly faded", "very faded", "extremely faded", "barely visible" }; + int findx = min(obj->spestudied, MAX_SPELL_STUDY); - int index = min(obj->spestudied, MAX_SPELL_STUDY); pline("The%s ink in this spellbook is %s.", objects[obj->otyp].oc_magic ? " magical" : "", - fadeness[index]); + fadeness[findx]); } return 1;