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

@@ -32,6 +32,8 @@ falling asleep when reading dull spellbook ignored sleep resistance
getpos() complaint about invalid movement keystroke didn't describe meta-chars
accurately
'realtime' value in xlogfile was incorrect if 'checkpoint' option was active
make a previously-discovered scroll written with marker while blind have its
label known so it can be read while blind
Platform- and/or Interface-Specific Fixes
@@ -51,6 +53,7 @@ X11: core bug for '`' (backtick) command was only noticed by X11 interface,
General New Features
--------------------
naming Sting or Orcrist now breaks illiterate conduct
different feedback for reading a scroll of mail created by writing with marker
Platform- and/or Interface-Specific New Features

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 bones.c $NHDT-Date: 1449269914 2015/12/04 22:58:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.66 $ */
/* NetHack 3.6 bones.c $NHDT-Date: 1450261363 2015/12/16 10:22:43 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */
@@ -118,15 +118,18 @@ boolean restore;
free_oname(otmp);
}
if (otmp->otyp == SLIME_MOLD)
if (otmp->otyp == SLIME_MOLD) {
goodfruit(otmp->spe);
#ifdef MAIL
else if (otmp->otyp == SCR_MAIL)
otmp->spe = 1;
} else if (otmp->otyp == SCR_MAIL) {
/* 0: delivered in-game via external event;
1: from bones or wishing; 2: written with marker */
if (otmp->spe == 0)
otmp->spe = 1;
#endif
else if (otmp->otyp == EGG)
} else if (otmp->otyp == EGG) {
otmp->spe = 0;
else if (otmp->otyp == TIN) {
} else if (otmp->otyp == TIN) {
/* make tins of unique monster's meat be empty */
if (otmp->corpsenm >= LOW_PM
&& unique_corpstat(&mons[otmp->corpsenm]))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mail.c $NHDT-Date: 1436754892 2015/07/13 02:34:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.20 $ */
/* NetHack 3.6 mail.c $NHDT-Date: 1450261364 2015/12/16 10:22:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -11,25 +11,24 @@
* Notify user when new mail has arrived. Idea by Merlyn Leroy.
*
* The mail daemon can move with less than usual restraint. It can:
* - move diagonally from a door
* - use secret and closed doors
* - run through a monster ("Gangway!", etc.)
* - run over pools & traps
* - move diagonally from a door
* - use secret and closed doors
* - run through a monster ("Gangway!", etc.)
* - run over pools & traps
*
* Possible extensions:
* - Open the file MAIL and do fstat instead of stat for efficiency.
* (But sh uses stat, so this cannot be too bad.)
* - Examine the mail and produce a scroll of mail named "From somebody".
* - Invoke MAILREADER in such a way that only this single letter is
*read.
* - Do something to the text when the scroll is enchanted or cancelled.
* - Make the daemon always appear at a stairwell, and have it find a
* path to the hero.
* - Open the file MAIL and do fstat instead of stat for efficiency.
* (But sh uses stat, so this cannot be too bad.)
* - Examine the mail and produce a scroll of mail named "From somebody".
* - Invoke MAILREADER in such a way that only this single mail is read.
* - Do something to the text when the scroll is enchanted or cancelled.
* - Make the daemon always appear at a stairwell, and have it find a
* path to the hero.
*
* Note by Olaf Seibert: On the Amiga, we usually don't get mail. So we go
* through most of the effects at 'random' moments.
* through most of the effects at 'random' moments.
* Note by Paul Winner: The MSDOS port also 'fakes' the mail daemon at
* random intervals.
* random intervals.
*/
STATIC_DCL boolean FDECL(md_start, (coord *));
@@ -418,9 +417,9 @@ ckmailstatus()
return;
}
if (--mustgetmail <= 0) {
static struct mail_info deliver = { MSG_MAIL,
"I have some mail for you", 0,
0 };
static struct mail_info deliver = {
MSG_MAIL, "I have some mail for you", 0, 0
};
newmail(&deliver);
mustgetmail = -1;
}
@@ -429,7 +428,7 @@ ckmailstatus()
/*ARGSUSED*/
void
readmail(otmp)
struct obj *otmp;
struct obj *otmp UNUSED;
{
static char *junk[] = {
NULL, /* placeholder for "Report bugs to <devteam@nethack.org>.", */
@@ -502,7 +501,7 @@ ckmailstatus()
/*ARGSUSED*/
void
readmail(otmp)
struct obj *otmp;
struct obj *otmp UNUSED;
{
#ifdef DEF_MAILREADER /* This implies that UNIX is defined */
register const char *mr = 0;
@@ -518,8 +517,8 @@ struct obj *otmp;
#else
#ifndef AMS /* AMS mailboxes are directories */
display_file(mailbox, TRUE);
#endif /* AMS */
#endif /* DEF_MAILREADER */
#endif /* AMS */
#endif /* DEF_MAILREADER */
/* get new stat; not entirely correct: there is a small time
window where we do not see new mail */
@@ -585,6 +584,8 @@ struct obj *otmp;
vms_doshell(cmd, TRUE);
(void) sleep(1);
}
#else
nhUse(otmp);
#endif /* SHELL */
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1449975408 2015/12/13 02:56:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.156 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1450261364 2015/12/16 10:22:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.157 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -3345,6 +3345,8 @@ typfnd:
break;
#ifdef MAIL
case SCR_MAIL:
/* 0: delivered in-game via external event (or randomly for fake mail);
1: from bones or wishing; 2: written with marker */
otmp->spe = 1;
break;
#endif

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 read.c $NHDT-Date: 1449972474 2015/12/13 02:07:54 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.127 $ */
/* NetHack 3.6 read.c $NHDT-Date: 1450261365 2015/12/16 10:22:45 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.128 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -970,12 +970,16 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
#ifdef MAIL
case SCR_MAIL:
known = TRUE;
if (sobj->spe)
if (sobj->spe == 2)
/* "stamped scroll" created via magic marker--without a stamp */
pline("This scroll is marked \"postage due\".");
else if (sobj->spe)
/* scroll of mail obtained from bones file or from wishing;
* note to the puzzled: the game Larn actually sends you junk
* mail if you win!
*/
pline(
"This seems to be junk mail addressed to the finder of the Eye of Larn.");
/* note to the puzzled: the game Larn actually sends you junk
* mail if you win!
*/
else
readmail(sobj);
break;

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;
}