falling into water while asleep

Try to fix the reported bug of not waking up if sleeping on ice
that gets melted out from under you.  This fixes the straightforward
case but I suspect there are other permutations that it doesn't cover.
Teleporting out of water is now blocked if asleep; waking up occurs
after the chance for that has passed.
This commit is contained in:
nethack.rankin
2003-02-11 11:57:14 +00:00
parent 731f4945ff
commit fe05bcf52d
2 changed files with 11 additions and 4 deletions

View File

@@ -380,6 +380,7 @@ xorns sink if the drawbridge they're standing on is raised
applying figurines to an adjacent spot over water does drowning checks
fix sequencing of Magicbane's hit messages
avoid buffer overflow from long or too many -s params
wake up first if trying to crawl out of water while asleep
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)trap.c 3.4 2003/01/08 */
/* SCCS Id: @(#)trap.c 3.4 2003/02/10 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2718,8 +2718,8 @@ drown()
vision_full_recalc = 1;
return(FALSE);
}
if((Teleportation || can_teleport(youmonst.data)) &&
(Teleport_control || rn2(3) < Luck+2)) {
if ((Teleportation || can_teleport(youmonst.data)) &&
!u.usleep && (Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell."); /* utcsri!carroll */
(void) dotele();
if(!is_pool(u.ux,u.uy))
@@ -2733,6 +2733,12 @@ drown()
}
#endif
crawl_ok = FALSE;
/* if sleeping, wake up now so that we don't crawl out of water
while still asleep; we can't do that the same way that waking
due to combat is handled; note unmul() clears u.usleep */
if (u.usleep) unmul("Suddenly you wake up!");
/* can't crawl if unable to move (crawl_ok flag stays false) */
if (multi < 0 || (Upolyd && !youmonst.data->mmove)) goto crawl;
/* look around for a place to crawl to */
for (i = 0; i < 100; i++) {
x = rn1(3,u.ux - 1);
@@ -2749,7 +2755,7 @@ drown()
crawl_ok = TRUE;
goto crawl;
}
crawl:;
crawl:
if (crawl_ok) {
boolean lost = FALSE;
/* time to do some strip-tease... */