Source:NetHack 2.3e/obj.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to obj.h from the source code of NetHack 2.3e. To link to a particular line, write [[NetHack 2.3e/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.    /*	SCCS Id: @(#)obj.h	2.3	88/01/21
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    
4.    #ifndef OBJ_H
5.    #define OBJ_H
6.    
7.    struct obj {
8.    	struct obj *nobj;
9.    	unsigned o_id;
10.   	unsigned o_cnt_id;		/* id of container object is in */
11.   	xchar ox,oy;
12.   	xchar odx,ody;
13.   	unsigned otyp;
14.   #ifdef DGK
15.   	unsigned int	owt;
16.   	unsigned int	quan;
17.   #else
18.   	uchar owt;
19.   	uchar quan;		/* use oextra for tmp gold objects */
20.   #endif
21.   	schar spe;		/* quality of weapon, armor or ring (+ or -)
22.   				   number of charges for wand ( >= -1 )
23.   				   special for uball and amulet %% BAH */
24.   	char olet;
25.   	char invlet;
26.   	Bitfield(oinvis,1);	/* not yet implemented */
27.   	Bitfield(odispl,1);
28.   	Bitfield(known,1);	/* exact nature known */
29.   	Bitfield(dknown,1);	/* color or text known */
30.   	Bitfield(cursed,1);
31.   	Bitfield(unpaid,1);	/* on some bill */
32.   	Bitfield(rustfree,1);
33.   	Bitfield(no_charge, 1);	/* if shk shouldn't charge for this */
34.   	Bitfield(onamelth,6);
35.   	long age;		/* creation date */
36.   	long owornmask;
37.   #define	W_ARM	01L
38.   #define	W_ARM2	02L
39.   #define	W_ARMH	04L
40.   #define	W_ARMS	010L
41.   #define	W_ARMG	020L
42.   #define	W_TOOL	040L	/* wearing a blindfold or badge */
43.   #ifdef SHIRT
44.   #define W_ARMU  0100L
45.   #define W_ARMOR		(W_ARM | W_ARM2 | W_ARMH | W_ARMS | W_ARMG | W_ARMU)
46.   #else
47.   #define	W_ARMOR		(W_ARM | W_ARM2 | W_ARMH | W_ARMS | W_ARMG)
48.   #endif
49.   #define	W_RINGL	010000L	/* make W_RINGL = RING_LEFT (see uprop) */
50.   #define	W_RINGR	020000L
51.   #define	W_RING		(W_RINGL | W_RINGR)
52.   #define	W_WEP	01000L
53.   #define	W_BALL	02000L
54.   #define	W_CHAIN	04000L
55.   	long oextra[1];		/* used for name of ordinary objects - length
56.   				   is flexible; amount for tmp gold objects */
57.   };
58.   
59.   extern struct obj *fobj;
60.   
61.   #define newobj(xl)	(struct obj *) alloc((unsigned)(xl) + sizeof(struct obj))
62.   #define	ONAME(otmp)	((char *) otmp->oextra)
63.   #define	OGOLD(otmp)	(otmp->oextra[0])
64.   
65.   #endif