Source:Hack 1.0/def.obj.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to def.obj.h from the source code of Hack 1.0. To link to a particular line, write [[Hack 1.0/def.obj.h#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.    struct obj {
4.    	struct obj *nobj;
5.    	unsigned o_id;
6.    	unsigned o_cnt_id;		/* id of container object is in */
7.    	xchar ox,oy;
8.    	xchar odx,ody;
9.    	uchar otyp;
10.   	uchar owt;
11.   	unsigned quan;	/* small in general but large in case of gold */
12.   	schar spe;
13.   	char olet;
14.   	Bitfield(oinvis,1);
15.   	Bitfield(odispl,1);
16.   	Bitfield(known,1);	/* exact nature known */
17.   	Bitfield(dknown,1);	/* color or text known */
18.   	Bitfield(cursed,1);
19.   	Bitfield(unpaid,1);	/* on some bill */
20.   	Bitfield(rustfree,1);
21.   	Bitfield(onamelth,6);
22.   	long age;	/* creation date */
23.   	long owornmask;
24.   #define	W_ARM	01L
25.   #define	W_ARM2	02L
26.   #define	W_ARMH	04L
27.   #define	W_ARMS	010L
28.   #define	W_ARMG	020L
29.   #define	W_ARMOR		(W_ARM | W_ARM2 | W_ARMH | W_ARMS | W_ARMG)
30.   #define	W_RINGL	010000L	/* make W_RINGL = RING_LEFT (see uprop) */
31.   #define	W_RINGR	020000L
32.   #define	W_RING		(W_RINGL | W_RINGR)
33.   #define	W_WEP	01000L
34.   #define	W_BALL	02000L
35.   #define	W_CHAIN	04000L
36.   	long oextra[1];
37.   };
38.   
39.   extern struct obj *fobj;
40.   
41.   #define newobj(xl)	(struct obj *) alloc((unsigned)(xl) + sizeof(struct obj))
42.   #define	ONAME(otmp)	((char *) otmp->oextra)