]> granicus.if.org Git - nethack/commitdiff
fix pull request #513 - applying books
authorPatR <rankin@nethack.org>
Wed, 19 May 2021 01:31:04 +0000 (18:31 -0700)
committerPatR <rankin@nethack.org>
Wed, 19 May 2021 01:31:04 +0000 (18:31 -0700)
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
src/apply.c

index 04d58c1e7b0272993e8e5207b13a6e14e67ac7f1..fffcfdf0958f7dabe1c3ee19854c8a5835776630 100644 (file)
@@ -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
index cc986a11b34897c9277160f0bb4a7a6299bdf88e..4a149cc3f66d7b7fa5ea73b0c1104da0ea6e6c4c 100644 (file)
@@ -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 charfadeness[] = {
+        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;