2,032pages on
this wiki
Add New Page
Add New Page Talk0

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

1.    /*	SCCS Id: @(#)edog.h	3.4	1997/10/23	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
The NetHack General Public License applies to screenshots, source code and other content from NetHack.
5.    #ifndef EDOG_H
6.    #define EDOG_H
8.    /*	various types of food, the lower, the better liked.	*/
10.   #define DOGFOOD 0
11.   #define CADAVER 1
12.   #define ACCFOOD 2
13.   #define MANFOOD 3
14.   #define APPORT	4
15.   #define POISON	5
16.   #define UNDEF	6
17.   #define TABU	7

All objects in the game (not only food) belong to one of these eight types. Pets will use the dogfood function in dog.c to decide the type of each object. Statements in dog.c and dogmove.c will handle the different types of objects. From the perspective of the mind of a pet, the eight types have these meanings:

  • DOGFOOD - "This is a treat! I will seek and eat as much of this as I can! If I notice this food, I will forget all else and go eat it!" "Okay, Master Dud— yippee, tripe!"
  • CADAVER - "This fresh corpse is good to eat, and I will try to eat it before anyone else eats it. I like to consume recently killed meat (or vegetable, if I am herbivorous). However, it is not a treat."
  • ACCFOOD - "I am near starving! I would not normally eat this, but I will accept it to cure my hunger. When I am not hungry, I will reclassify this as MANFOOD."
  • MANFOOD - "This looks edible, but I do not want to eat it. Maybe I can give it to my master, and my master will eat it."
  • APPORT - "This object does not seem to be food. Maybe I can bring (apport) this thing to my master."
  • UNDEF - "This object seems completely unimportant, so I will ignore it."
  • TABU - "I must keep this object away from my mouth. It looks unhealthy, and not safe to eat. I will not bite this, and I will not carry this." Old corpses come into this category. So do acidic corpses, poisonous corpses, stoning corpses (like cockatrice meat!), and tins containing them, unless the pet has the correct resistance.
19.   struct edog {
20.   	long droptime;			/* moment dog dropped object */
21.   	unsigned dropdist;		/* dist of drpped obj from @ */
22.   	int apport;			/* amount of training */
23.   	long whistletime;		/* last time he whistled */
24.   	long hungrytime;		/* will get hungry at this time */
25.   	coord ogoal;			/* previous goal location */
26.   	int abuse;			/* track abuses to this pet */
27.   	int revivals;			/* count pet deaths */
28.   	int mhpmax_penalty;		/* while starving, points reduced */
29.   	Bitfield(killed_by_u, 1);	/* you attempted to kill him */
30.   };
31.   #define EDOG(mon)	((struct edog *)&(mon)->mextra[0])
33.   #endif /* EDOG_H */

Also on Fandom

Random Wiki