Wikihack
Advertisement

Below is the full text to objclass.h from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/objclass.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.
1.    /*	SCCS Id: @(#)objclass.h	3.0	89/01/10
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef OBJCLASS_H
6.    #define OBJCLASS_H
7.    
8.    /* definition of a class of objects */
9.    
10.   struct objclass {
11.   	char *oc_name;		/* actual name */
12.   	char *oc_descr;		/* description when name unknown */
13.   	char *oc_uname;		/* called by user */
14.   	Bitfield(oc_name_known,1);
15.   	Bitfield(oc_merge,1);	/* merge otherwise equal objects */
16.   	Bitfield(oc_bool,1);
17.   #define oc_bimanual	oc_bool	/* for weapons */
18.   #define oc_bulky	oc_bool	/* for armor */
19.   #define oc_charged	oc_bool	/* for rings & tools: allow +n or (n) */
20.   	Bitfield(oc_material,4);
21.   #define GLASS	1
22.   #define WOOD	2
23.   #define METAL	4
24.   #define MINERAL	8
25.   	uchar oc_oprop; 	/* property (invis, &c.) conveyed */
26.   	char oc_olet;
27.   	int oc_prob;		/* probability for mkobj() */
28.   	schar oc_delay;		/* delay when using such an object */
29.   	uchar oc_weight;
30.   	int oc_cost;		/* base cost in shops */
31.   	schar oc_oc1, oc_oc2;
32.   	int oc_oi;
33.   #define	nutrition	oc_oi	/* for foods */
34.   #define w_propellor	oc_oi	/* for weapons */
35.   #define WP_BOW		1
36.   #define WP_SLING	2
37.   #define WP_CROSSBOW	3
38.   #define	a_ac		oc_oc1	/* for armors - only used in ARM_BONUS */
39.   #define ARM_BONUS(obj)	((10 - objects[obj->otyp].a_ac) + obj->spe)
40.   #define	a_can		oc_oc2	/* for armors */
41.   #define bits		oc_oc1	/* for wands */
42.   				/* wands */
43.   #define		NODIR		1
44.   #define		IMMEDIATE	2
45.   #define		RAY		4
46.     /* Check the AD&D rules!  The FIRST is small monster damage. */
47.   #define	wsdam		oc_oc1	/* for weapons, PICK_AXE, rocks, and gems */
48.   #define	wldam		oc_oc2	/* for weapons, PICK_AXE, rocks, and gems */
49.   
50.   #define	g_val		oc_cost	/* for gems: value on exit */
51.   
52.   #ifdef SPELLS
53.   #define spl_lev		oc_oi	/* for books: spell level */
54.   #endif
55.   };
56.   
57.   extern struct objclass objects[];
58.   
59.   /* definitions of all object-symbols */
60.   
61.   #define	RANDOM_SYM	'\0'	/* used for generating random objects */
62.   #define	ILLOBJ_SYM	'\\'
63.   #define	AMULET_SYM	'"'
64.   #define	FOOD_SYM	'%'
65.   #define	WEAPON_SYM	')'
66.   #define	TOOL_SYM	'('
67.   #define	BALL_SYM	'0'
68.   #define	CHAIN_SYM	'_'
69.   #define	ROCK_SYM	'`'
70.   #define	ARMOR_SYM	'['
71.   #define	POTION_SYM	'!'
72.   #define	SCROLL_SYM	'?'
73.   #define	WAND_SYM	'/'
74.   #define	RING_SYM	'='
75.   #define	GEM_SYM		'*'
76.   #define	GOLD_SYM	'$'
77.   #define	VENOM_SYM	'.'
78.   #ifdef SPELLS
79.   #define	SPBOOK_SYM	'+'	/* actually SPELL-book */
80.   #endif
81.   /* Other places with explicit knowledge of object symbols:
82.    * pager.c:	if(q == '%') pline("%%	a piece of food");
83.    */
84.   
85.   struct fruit {
86.   	char fname[PL_FSIZ];
87.   	int fid;
88.   	struct fruit *nextf;
89.   };
90.   #define newfruit() (struct fruit *)alloc(sizeof(struct fruit))
91.   #endif /* OBJCLASS_H */
Advertisement