]> granicus.if.org Git - nethack/commitdiff
getobj() magic marker candidate items
authorPatR <rankin@nethack.org>
Wed, 13 Jan 2016 01:50:32 +0000 (17:50 -0800)
committerPatR <rankin@nethack.org>
Wed, 13 Jan 2016 01:50:32 +0000 (17:50 -0800)
When applying a magic marker, only list known blank scrolls and known
blank spellbooks as likely candidates to write on.  Accepts any scroll
or book (but non-blank ones will get rejected by the writing code).
Attempting to choose some other class of item yields "that is a silly
thing to write on", same as before.

This was requested during beta testing and I'd swear that I checked it
in a long time ago, but it wasn't here.

doc/fixes36.1
src/invent.c

index 96c0ee768ffa3522cee6253404dacb70f6eac4ba..a27392c575336809209f2f9eeb34d504c574c7a2 100644 (file)
@@ -109,6 +109,8 @@ don't create globs of ooze/slime/pudding with bknown flag set so pre-known to
 do allow globs with same curse/bless state to merge even when that state is
        known for one and unknown for the other; result will have bknown clear
 fix pile mark after killing a monster carrying a potion which is destroyed
+only list known blank scrolls and known blank spellbooks as likely candidates
+       when choosing an item to write on for applied magic marker
 
 
 Platform- and/or Interface-Specific Fixes
index 94ae77d7cfa2ecaabfb44c1625713faf1a32d035..6bbd89ca5628ce8b41bf7b1a9b5419744d7ff53a 100644 (file)
@@ -1134,6 +1134,9 @@ register const char *let, *word;
              /* worn armor or accessory covered by cursed worn armor */
              || (taking_off(word)
                  && inaccessible_equipment(otmp, (const char *) 0, TRUE))
+             || (!strcmp(word, "write on")
+                 && (!(otyp == SCR_BLANK_PAPER || otyp == SPE_BLANK_PAPER)
+                     || !otmp->dknown || !objects[otyp].oc_name_known))
              ) {
                 /* acceptable but not listed as likely candidate */
                 foo--;
@@ -1160,6 +1163,11 @@ register const char *let, *word;
     if (!foo && !allowall && !allownone) {
         You("don't have anything %sto %s.", foox ? "else " : "", word);
         return (struct obj *) 0;
+    } else if (!strcmp(word, "write on")) { /* ugly check for magic marker */
+        /* we wanted all scrolls and books in altlets[], but that came with
+           'allowall' which we don't want since it prevents "silly thing"
+           result if anything other than scroll or spellbook is chosen */
+        allowall = FALSE;
     }
     for (;;) {
         cnt = 0;