restful sleep bit (trunk only)

A change yesterday made putting on an amulet of restful sleep avoid
clobbering the timeout from having already eaten one, only replace it if
the new timeout is shorter.  This does the inverse; when eating one, if
you're already sleepy from also wearing that type of amulet, only replace
the timeout if new one is shorter.  And don't clobber the other intrinsic
bits with FROMOUTSIDE, just add it to whatever ones might already be set.
Neither should have any observable effect on game play, so no fixes entry.
This commit is contained in:
nethack.rankin
2008-05-27 04:49:43 +00:00
parent 9dce52ea98
commit 6a259a1464

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)eat.c 3.5 2007/03/19 */
/* SCCS Id: @(#)eat.c 3.5 2008/05/26 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1945,9 +1945,16 @@ struct obj *otmp;
choke(otmp);
break;
case AMULET_OF_RESTFUL_SLEEP: /* another bad idea! */
{
long newnap = (long)rnd(100), oldnap = (HSleeping & TIMEOUT);
if (!(HSleeping & FROMOUTSIDE))
accessory_has_effect(otmp);
HSleeping = FROMOUTSIDE | rnd(100);
HSleeping |= FROMOUTSIDE;
/* might also be wearing one; use shorter of two timeouts */
if (newnap < oldnap || oldnap == 0L)
HSleeping = (HSleeping & ~TIMEOUT) | newnap;
}
break;
case RIN_SUSTAIN_ABILITY:
case AMULET_OF_LIFE_SAVING: