Source:NetHack 3.4.3/include/edog.h

From NetHackWiki
Revision as of 19:17, 31 January 2011 by Paxedbot (talk | contribs) (moved Source:Edog.h to Source:NetHack 3.4.3/include/edog.h: Moving src to subdirs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.

/*	SCCS Id: @(#)edog.h	3.4	1997/10/23	*/
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed.  See license for details. */

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.

#ifndef EDOG_H
#define EDOG_H

/*	various types of food, the lower, the better liked.	*/

#define DOGFOOD 0
#define CADAVER 1
#define ACCFOOD 2
#define MANFOOD 3
#define APPORT	4
#define POISON	5
#define UNDEF	6
#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.
struct edog {
	long droptime;			/* moment dog dropped object */
	unsigned dropdist;		/* dist of drpped obj from @ */
	int apport;			/* amount of training */
	long whistletime;		/* last time he whistled */
	long hungrytime;		/* will get hungry at this time */
	coord ogoal;			/* previous goal location */
	int abuse;			/* track abuses to this pet */
	int revivals;			/* count pet deaths */
	int mhpmax_penalty;		/* while starving, points reduced */
	Bitfield(killed_by_u, 1);	/* you attempted to kill him */
};
#define EDOG(mon)	((struct edog *)&(mon)->mextra[0])

#endif /* EDOG_H */