scrolls written while blind; scrolls of mail

Make a fix suggested during beta testing:  you can read scrolls while
blind if you know the label, and you can write a scroll with a magic
marker while blind, but the result was flagged as description unknown
so you couldn't read the newly written scroll until regaining sight
or obtaining object identification.  So change writing a previously
discovered scroll while blind to set dknown since a successful write
always yields the type of scroll requested.  Getting lucky while
attempting to write an undiscovered scroll--which has to be done by
scroll's type name (for instance "food detection") rather than by its
label ("YUM YUM")--still leaves the description flagged as unknown
since hero hasn't seen the what sort of label the new scroll has.

Along the way I got side-tracked by the possibilty of writing a scroll
of mail.  It's allowed and yielded the same result as finding such a
scroll in bones, or wishing for one:  when read, it was junk mail from
Larn.  Make one written via marker give different feedback since it
comes from creation of a stamped scroll without any stamps available.

Also, suppress an "argument not used" warning for readmail().
This commit is contained in:
PatR
2015-12-16 02:23:32 -08:00
parent 8f96d4b9ef
commit af6887796f
6 changed files with 62 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 write.c $NHDT-Date: 1446078770 2015/10/29 00:32:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */
/* NetHack 3.6 write.c $NHDT-Date: 1450261366 2015/12/16 10:22:46 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.17 $ */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
@@ -58,7 +58,7 @@ register struct obj *otmp;
}
/* decide whether the hero knowns a particular scroll's label;
unfortunately, we can't track things are haven't been added to
unfortunately, we can't track things that haven't been added to
the discoveries list and aren't present in current inventory,
so some scrolls with ought to yield True will end up False */
STATIC_OVL boolean
@@ -335,11 +335,20 @@ found:
new_obj->cursed = (curseval < 0);
#ifdef MAIL
if (new_obj->otyp == SCR_MAIL)
new_obj->spe = 1;
/* 0: delivered in-game via external event (or randomly for fake mail);
1: from bones or wishing; 2: written with marker */
new_obj->spe = 2;
#endif
new_obj =
hold_another_object(new_obj, "Oops! %s out of your grasp!",
The(aobjnam(new_obj, "slip")), (const char *) 0);
/* unlike alchemy, for example, a successful result yields the
specifically chosen item so hero recognizes it even if blind;
the exception is for being lucky writing an undiscovered scroll,
where the label associated with the type-name isn't known yet */
new_obj->dknown = label_known(new_obj->otyp, invent) ? 1 : 0;
new_obj = hold_another_object(new_obj, "Oops! %s out of your grasp!",
The(aobjnam(new_obj, "slip")),
(const char *) 0);
nhUse(new_obj); /* try to avoid complaint about dead assignment */
return 1;
}