Source:NetHack 3.1.0/obj.h
Jump to navigation
Jump to search
Below is the full text to obj.h from the source code of NetHack 3.1.0. To link to a particular line, write [[NetHack 3.1.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.1 92/10/18 */ 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. /* #define obj obj_nh /* uncomment for SCO UNIX, which has a conflicting 9. * typedef for "obj" in <sys/types.h> */ 10. 11. struct obj { 12. struct obj *nobj; 13. struct obj *nexthere; /* for location lists */ 14. struct obj *cobj; /* contents list for containers */ 15. /* unsigned o_cwt; /* container weight capacity */ 16. unsigned o_id; 17. xchar ox,oy; 18. short otyp; /* object class number */ 19. unsigned owt; 20. long quan; /* number of items */ 21. 22. schar spe; /* quality of weapon, armor or ring (+ or -) 23. number of charges for wand ( >= -1 ) 24. marks your eggs, spinach tins 25. indicates statues have spellbooks inside 26. tells which fruit a fruit is 27. marks diluted potions 28. special for uball and amulet %% BAH */ 29. char oclass; /* object class */ 30. char invlet; /* designation in inventory */ 31. char oartifact; /* artifact array index */ 32. 33. Bitfield(cursed,1); 34. Bitfield(blessed,1); 35. Bitfield(unpaid,1); /* on some bill */ 36. Bitfield(no_charge,1); /* if shk shouldn't charge for this */ 37. Bitfield(known,1); /* exact nature known */ 38. Bitfield(dknown,1); /* color or text known */ 39. Bitfield(bknown,1); /* blessing or curse known */ 40. Bitfield(rknown,1); /* rustproof or not known */ 41. 42. Bitfield(oeroded,2); /* rusted/corroded/burnt/rotted weapon/armor */ 43. #define MAX_ERODE 3 44. #define orotten oeroded /* rotten food */ 45. Bitfield(oerodeproof,1); /* erodeproof weapon/armor */ 46. Bitfield(olocked,1); /* object is locked */ 47. #define recharged olocked /* recharged once */ 48. Bitfield(obroken,1); /* lock has been broken */ 49. Bitfield(otrapped,1); /* container is trapped */ 50. #define opoisoned otrapped /* object (weapon) is coated with poison */ 51. Bitfield(oldcorpse,1); /* for troll corpses too old to revive */ 52. #ifndef NO_SIGNAL 53. # define in_use oldcorpse /* for magic items before useup items */ 54. #endif 55. Bitfield(lamplit,1); /* a light-source -- can be lit */ 56. 57. Bitfield(oinvis,1); /* not yet implemented */ 58. Bitfield(greased,1); /* covered with grease */ 59. Bitfield(onamelth,6); 60. 61. int corpsenm; /* type of corpse is mons[corpsenm] */ 62. #define leashmon corpsenm /* gets m_id of attached pet */ 63. #define spestudied corpsenm /* how many times a spellbook has been studied */ 64. unsigned oeaten; /* nutrition left in food, if partly eaten */ 65. long age; /* creation date */ 66. long owornmask; 67. 68. /* note that TIMEOUT in you.h is defined as 07777L; no bits for items that 69. * confer properties may overlap that mask, or timeout.c will happily 70. * rearrange the bits behind the back of the property code 71. * shirts, balls, and chains are currently safe 72. * FROMOUTSIDE and FROMEXPER in you.h are defined as 020000000L and 0400000000L 73. * respectively. Declarations here should not overlap with those bits either. 74. */ 75. #define W_BALL 02000L 76. #define W_CHAIN 04000L 77. #define W_RINGL 010000L /* make W_RINGL = RING_LEFT (see uprop) */ 78. #define W_RINGR 020000L 79. #define W_RING (W_RINGL | W_RINGR) 80. #define W_ARM 040000L 81. #define W_ARMC 0100000L 82. #define W_ARMH 0200000L 83. #define W_ARMS 0400000L 84. #define W_ARMG 01000000L 85. #define W_ARMF 02000000L 86. #define W_AMUL 04000000L 87. #define W_TOOL 010000000L /* wearing another tool (see uprop) */ 88. #define W_WEP 020000000L 89. #define W_ART 040000000L /* _carrying_ an artifact, not really worn */ 90. #define W_ARTI 0100000000L /* an invoked artifact, not really worn */ 91. #ifdef TOURIST 92. #define W_ARMU 01000L 93. #define W_ARMOR (W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF | W_ARMU) 94. #else 95. #define W_ARMOR (W_ARM | W_ARMC | W_ARMH | W_ARMS | W_ARMG | W_ARMF) 96. #endif 97. long oextra[1]; /* used for name of ordinary objects - length 98. is flexible; amount for tmp gold objects */ 99. }; 100. 101. #define newobj(xl) (struct obj *)alloc((unsigned)(xl) + sizeof(struct obj)) 102. #define dealloc_obj(obj) free((genericptr_t) (obj)) 103. #define ONAME(otmp) ((char *)(otmp)->oextra) 104. 105. #define Is_container(otmp) (otmp->otyp >= LARGE_BOX && \ 106. otmp->otyp <= BAG_OF_TRICKS) 107. #define Is_box(otmp) (otmp->otyp == LARGE_BOX || otmp->otyp == CHEST) 108. #define Is_mbag(otmp) (otmp->otyp == BAG_OF_HOLDING || \ 109. otmp->otyp == BAG_OF_TRICKS) 110. 111. #define is_sword(otmp) (otmp->otyp >= SHORT_SWORD && \ 112. otmp->otyp <= RUNESWORD) 113. #define is_blade(otmp) (otmp->otyp >= DAGGER && \ 114. otmp->otyp <= BILL_GUISARME) 115. #define bimanual(otmp) ((otmp->oclass == WEAPON_CLASS || \ 116. otmp->otyp == UNICORN_HORN) && \ 117. objects[otmp->otyp].oc_bimanual) 118. 119. #define Is_candle(otmp) (otmp->otyp == TALLOW_CANDLE || \ 120. otmp->otyp == WAX_CANDLE) 121. 122. #endif /* OBJ_H */