]> granicus.if.org Git - nethack/commitdiff
unconsciousness (trunk only)
authornethack.rankin <nethack.rankin>
Sat, 4 Feb 2012 07:20:23 +0000 (07:20 +0000)
committernethack.rankin <nethack.rankin>
Sat, 4 Feb 2012 07:20:23 +0000 (07:20 +0000)
     When testing armor theft by nymph I got a message "you dream that you
hear <something or other>" even though I was awake.  steal() was leaving
nomovemsg null in order to get the default of "you can move again", but
unconscious() was treating null value as 'yes, hero is unconscious'.  I'm
pretty sure its intent was just to guard against passing null to strncmpi()
and didn't really mean that null indicates unconsciousness.

src/trap.c

index 726298a5a8e10e8bee53f808b89ae687e03ff724..ce41423de1af0f682866893ecf64c243c49fb282 100644 (file)
@@ -4665,11 +4665,11 @@ boolean nocorpse;
 boolean
 unconscious()
 {
-       return((boolean)(multi < 0 && (!nomovemsg ||
-               u.usleep ||
-               !strncmp(nomovemsg,"You awake", 9) ||
-               !strncmp(nomovemsg,"You regain con", 14) ||
-               !strncmp(nomovemsg,"You are consci", 14))));
+       return (boolean)(multi < 0 &&
+                 (u.usleep || (nomovemsg &&
+                               (!strncmp(nomovemsg, "You awake", 9) ||
+                                !strncmp(nomovemsg, "You regain con", 14) ||
+                                !strncmp(nomovemsg, "You are consci", 14)))));
 }
 
 static const char lava_killer[] = "molten lava";