Source:NetHack 3.4.3/include/region.h

From NetHackWiki
Jump to: navigation, search

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

  1. /*	SCCS Id: @(#)region.h	3.4	2002/10/15	*/
  2. /* Copyright (c) 1996 by Jean-Christophe Collet			  */
  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.

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. #ifndef REGION_H
  2. #define REGION_H
  3.  
  4. /* generic callback function */
  5.  
  6. typedef boolean FDECL((*callback_proc), (genericptr_t, genericptr_t));
  7.  
  8. /*
  9. * Overload the old player_inside field with two values, coded in such
  10. * a way as to retain compatibility with 3.4.0 save and bones files;
  11. * this relies on the fact that nethack's `boolean' is really stored
  12. * in a `char' (or bigger type) rather than in a single bit.
  13. *
  14. * 3.4.1 save and bones files will be correct.
  15. * 3.4.0 save files restored under 3.4.1 will be correct.
  16. * 3.4.0 bones files used with 3.4.1 will continue to have the minor
  17. *	 3.4.0 bug of falsely claiming that the current game's hero is
  18. *	 responsible for the dead former hero's stinking clouds.
  19. */
  20. #define REG_HERO_INSIDE	1
  21. #define REG_NOT_HEROS	2
  22. #define hero_inside(r)	((unsigned)(r)->player_flags & REG_HERO_INSIDE)
  23. #define heros_fault(r)	(!((unsigned)(r)->player_flags & REG_NOT_HEROS))
  24. #define set_hero_inside(r)	((r)->player_flags |= REG_HERO_INSIDE)
  25. #define clear_hero_inside(r)	((r)->player_flags &= ~REG_HERO_INSIDE)
  26. #define set_heros_fault(r)	((r)->player_flags &= ~REG_NOT_HEROS)
  27. #define clear_heros_fault(r)	((r)->player_flags |= REG_NOT_HEROS)
  28.  
  29. typedef struct {
  30. NhRect bounding_box;		/* Bounding box of the region */
  31. NhRect *rects;		/* Rectangles composing the region */
  32. short  nrects;		/* Number of rectangles  */
  33. boolean attach_2_u;		/* Region attached to player ? */
  34. unsigned int attach_2_m;	/* Region attached to monster ? */
  35. /*struct obj *attach_2_o;*/	/* Region attached to object ? UNUSED YET */
  36. const char* enter_msg;	/* Message when entering */
  37. const char* leave_msg;	/* Message when leaving */
  38. short  ttl;			/* Time to live. -1 is forever */
  39. short expire_f;		/* Function to call when region's ttl expire */
  40. short can_enter_f;		/* Function to call to check wether the player
  41. 				   can, or can not, enter the region */
  42. short enter_f;		/* Function to call when the player enters*/
  43. short can_leave_f;		/* Function to call to check wether the player
  44. 				   can, or can not, leave the region */
  45. short leave_f;		/* Function to call when the player leaves */
  46. short inside_f;		/* Function to call every turn if player's
  47. 				   inside */
  48. boolean player_flags;	/* (see above) */
  49. unsigned int* monsters;	/* Monsters currently inside this region */
  50. short n_monst;		/* Number of monsters inside this region */
  51. short max_monst;		/* Maximum number of monsters that can be
  52. 				   listed without having to grow the array */
  53. #define MONST_INC	5
  54.  
  55. /* Should probably do the same thing about objects */
  56.  
  57. boolean visible;		/* Is the region visible ? */
  58. int glyph;			/* Which glyph to use if visible */
  59. genericptr_t arg;		/* Optional user argument (Ex: strength of
  60. 				   force field, damage of a fire zone, ...*/
  61. } NhRegion;
  62.  
  63. #endif /* REGION_H */