Source:NetHack 3.0.0/obj.h

From NetHackWiki
(Redirected from NetHack 3.0.0/obj.h)
Jump to navigation Jump to search

Below is the full text to obj.h from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/obj.h#line123]], for example.

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

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)obj.h	3.0	88/04/12
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef OBJ_H
6.    #define OBJ_H
7.    
8.    struct obj {
9.    	struct obj *nobj;
10.   	struct obj *cobj;		/* id of container object is in */
11.   /*	unsigned o_cwt;			/* container weight capacity */
12.   	unsigned o_id;
13.   	xchar ox,oy;
14.   	xchar odx,ody;
15.   	unsigned otyp;
16.   	unsigned owt;
17.   	unsigned quan;		/* use oextra for tmp gold objects */
18.   
19.   	schar spe;		/* quality of weapon, armor or ring (+ or -)
20.   				   number of charges for wand ( >= -1 )
21.   				   marks your eggs, spinach tins, key shapes
22.   				   indicates statues have spellbooks inside
23.   				   tells which fruit a fruit is
24.   				   special for uball and amulet %% BAH */
25.   #define N_LOX	10	/* # of key/lock shapes */
26.   	char	olet;
27.   	char	invlet;
28.   	int	corpsenm;	/* type of corpse is mons[corpsenm] */
29.   #define leashmon  corpsenm	/* gets m_id of attached pet */
30.   	Bitfield(oinvis,1);	/* not yet implemented */
31.   	Bitfield(olocked,1);	/* object is locked */
32.   #define recharged olocked	/* recharged once */
33.   	Bitfield(otrapped,1);	/* container is trapped */
34.   #define opoisoned otrapped	/* weapon has been coated with poison */
35.   	Bitfield(odispl,1);
36.   	Bitfield(known,1);	/* exact nature known */
37.   	Bitfield(dknown,1);	/* color or text known */
38.   	Bitfield(bknown,1);	/* blessing or curse known */
39.   	Bitfield(cursed,1);
40.   	Bitfield(blessed,1);
41.   	Bitfield(unpaid,1);	/* on some bill */
42.   	Bitfield(rustfree,1);
43.   #define flameproof 	rustfree/* for non-metal armor items */
44.   	Bitfield(no_charge,1);	/* if shk shouldn't charge for this */
45.   	Bitfield(onamelth,6);
46.   	long age;		/* creation date */
47.   	long owornmask;
48.   #define	W_ARM	040000L
49.   #define	W_ARMC	0100000L
50.   #define	W_ARMH	0200000L
51.   #define	W_ARMS	0400000L
52.   #define	W_ARMG	01000000L
53.   #define	W_ARMF	02000000L
54.   #define	W_AMUL	04000000L
55.   #define	W_TOOL	010000000L	/* wearing another tool (see uprop) */
56.   #ifdef SHIRT
57.   #define	W_ARMU	020000000L
58.   #define	W_ARMOR	(W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF | W_ARMU)
59.   #else
60.   #define	W_ARMOR	(W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF)
61.   #endif
62.   #define	W_RINGL	010000L	/* make W_RINGL = RING_LEFT (see uprop) */
63.   #define	W_RINGR	020000L
64.   #define	W_RING	(W_RINGL | W_RINGR)
65.   #define	W_WEP	01000L
66.   #define	W_BALL	02000L
67.   #define	W_CHAIN	04000L
68.   	long oextra[1];		/* used for name of ordinary objects - length
69.   				   is flexible; amount for tmp gold objects */
70.   };
71.   
72.   extern struct obj *fobj;
73.   
74.   #define newobj(xl)	(struct obj *) alloc((unsigned)(xl) + sizeof(struct obj))
75.   #define	ONAME(otmp)	((char *) otmp->oextra)
76.   #define	OGOLD(otmp)	(otmp->oextra[0])
77.   
78.   # ifndef STUPID_CPP	/* otherwise these macros are functions in lock.c */
79.   #define Is_container(otmp)	(otmp->otyp >= ICE_BOX && otmp->otyp <= BAG_OF_TRICKS)
80.   #define Is_box(otmp)	(otmp->otyp == LARGE_BOX || otmp->otyp == CHEST)
81.   #define Is_mbag(otmp)	(otmp->otyp == BAG_OF_HOLDING || otmp->otyp == BAG_OF_TRICKS)
82.   
83.   #define is_sword(otmp)	(otmp->otyp >= SHORT_SWORD && otmp->otyp <= KATANA)
84.   #define bimanual(otmp)	(otmp->olet == WEAPON_SYM && objects[otmp->otyp].oc_bimanual)
85.   # endif /* STUPID_CPP */
86.   
87.   #endif /* OBJ_H /**/