Source:Hack 1.0/hack.timeout.c

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to hack.timeout.c from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/hack.timeout.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

Screenshots and source code from Hack are used under the CWI license.

1.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
2.    
3.    #include	"hack.h"
4.    #define	SIZE(x)	(sizeof(x) / sizeof(x[0]))
5.    
6.    timeout(){
7.    register struct prop *upp;
8.    	for(upp = u.uprops; upp < u.uprops+SIZE(u.uprops); upp++)
9.    	    if((upp->p_flgs & TIMEOUT) && !--upp->p_flgs) {
10.   		if(upp->p_tofn) (*upp->p_tofn)();
11.   		else switch(upp - u.uprops){
12.   		case SICK:
13.   			pline("You die because of food poisoning");
14.   			killer = u.usick_cause;
15.   			done("died");
16.   			/* NOTREACHED */
17.   		case FAST:
18.   			pline("You feel yourself slowing down");
19.   			break;
20.   		case CONFUSION:
21.   			pline("You feel less confused now");
22.   			break;
23.   		case BLIND:
24.   			pline("You can see again");
25.   			setsee();
26.   			break;
27.   		case INVIS:
28.   			on_scr(u.ux,u.uy);
29.   			pline("You are no longer invisible.");
30.   		}
31.   	}
32.   }