room.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #ifndef __ROOM_H
  2. #define __ROOM_H
  3. //*****************************************************************************
  4. //
  5. // room.h
  6. //
  7. // the basic interface for working with the room structure.
  8. //
  9. // the basic interface for working with the room data structure. If you plan on
  10. // adding any other information to rooms, it is strongly suggested you do so
  11. // through auxiliary data (see auxiliary.h)
  12. //
  13. // For a recap, IF YOU PLAN ON ADDING ANY OTHER INFORMATION TO ROOMS, IT
  14. // IS STRONGLY SUGGESTED YOU DO SO THROUGH AUXILIARY DATA (see auxiliary.h).
  15. //
  16. //*****************************************************************************
  17. #define DIR_NONE (-1)
  18. #define DIR_NORTH 0
  19. #define DIR_EAST 1
  20. #define DIR_SOUTH 2
  21. #define DIR_WEST 3
  22. #define DIR_UP 4
  23. #define DIR_DOWN 5
  24. #define DIR_NORTHEAST 6
  25. #define DIR_SOUTHEAST 7
  26. #define DIR_SOUTHWEST 8
  27. #define DIR_NORTHWEST 9
  28. #define NUM_DIRS 10
  29. #define TERRAIN_NONE (-1)
  30. #define TERRAIN_INDOORS 0
  31. #define TERRAIN_CITY 1
  32. #define TERRAIN_ROAD 2
  33. #define TERRAIN_ALLEY 3
  34. #define TERRAIN_BRIDGE 4
  35. #define TERRAIN_SHALLOW_WATER 5
  36. #define TERRAIN_DEEP_WATER 6
  37. #define TERRAIN_OCEAN 7
  38. #define TERRAIN_UNDERWATER 8
  39. #define TERRAIN_FIELD 9
  40. #define TERRAIN_PLAINS 10
  41. #define TERRAIN_MEADOW 11
  42. #define TERRAIN_FOREST 12
  43. #define TERRAIN_DEEP_FOREST 13
  44. #define TERRAIN_HILLS 14
  45. #define TERRAIN_HIGH_HILLS 15
  46. #define TERRAIN_MOUNTAIN 16
  47. #define TERRAIN_SWAMP 17
  48. #define TERRAIN_DEEP_SWAMP 18
  49. #define TERRAIN_SAND 19
  50. #define TERRAIN_DESERT 20
  51. #define TERRAIN_ICE 21
  52. #define TERRAIN_GLACIER 22
  53. #define TERRAIN_CAVERN 23
  54. #define NUM_TERRAINS 24
  55. //
  56. // Create a clean, new room
  57. ROOM_DATA *newRoom();
  58. //
  59. // Delete a room, and detach it from all of its dependant structures
  60. void deleteRoom(ROOM_DATA *room);
  61. //
  62. // make a copy of the room
  63. ROOM_DATA *roomCopy(ROOM_DATA *room);
  64. //
  65. // Copy one room to another
  66. void roomCopyTo(ROOM_DATA *from, ROOM_DATA *to);
  67. //
  68. // parse and store room data
  69. ROOM_DATA *roomRead(STORAGE_SET *set);
  70. STORAGE_SET *roomStore(ROOM_DATA *room);
  71. bool roomIsInstance(ROOM_DATA *room, const char *prototype);
  72. const char *roomGetPrototypes(ROOM_DATA *room);
  73. void roomAddPrototype(ROOM_DATA *room, const char *prototype);
  74. void roomSetPrototypes(ROOM_DATA *room, const char *prototypes);
  75. //*****************************************************************************
  76. // add and remove functions
  77. //*****************************************************************************
  78. void roomRemoveChar (ROOM_DATA *room, const CHAR_DATA *ch);
  79. void roomRemoveObj (ROOM_DATA *room, const OBJ_DATA *obj);
  80. void roomAddChar (ROOM_DATA *room, CHAR_DATA *ch);
  81. void roomAddObj (ROOM_DATA *room, OBJ_DATA *obj);
  82. //*****************************************************************************
  83. // get and set functions for rooms
  84. //*****************************************************************************
  85. const char *roomGetName (const ROOM_DATA *room);
  86. const char *roomGetDesc (const ROOM_DATA *room);
  87. int roomGetTerrain (const ROOM_DATA *room);
  88. BUFFER *roomGetDescBuffer (const ROOM_DATA *room);
  89. void roomSetExit(ROOM_DATA *room, const char *dir, EXIT_DATA *exit);
  90. EXIT_DATA *roomGetExit(ROOM_DATA *room, const char *dir);
  91. EXIT_DATA *roomRemoveExit(ROOM_DATA *room, const char *dir);
  92. const char *roomGetExitDir(ROOM_DATA *room, EXIT_DATA *exit);
  93. LIST *roomGetExitNames(ROOM_DATA *room);
  94. EDESC_SET *roomGetEdescs (const ROOM_DATA *room);
  95. const char *roomGetEdesc (const ROOM_DATA *room, const char *keyword);
  96. void *roomGetAuxiliaryData(const ROOM_DATA *room, const char *name);
  97. LIST *roomGetCharacters (const ROOM_DATA *room);
  98. LIST *roomGetContents (const ROOM_DATA *room);
  99. BITVECTOR *roomGetBits (const ROOM_DATA *room);
  100. int roomGetUID (const ROOM_DATA *room);
  101. time_t roomGetBirth (const ROOM_DATA *room);
  102. NEAR_MAP *roomGetCmdTable (const ROOM_DATA *room);
  103. bool roomHasCmds (const ROOM_DATA *room);
  104. bool roomHasCmd (const ROOM_DATA *room, const char *name);
  105. void roomAddCmd (ROOM_DATA *room, const char *name,
  106. const char *abbr, CMD_DATA *cmd);
  107. CMD_DATA *roomRemoveCmd (ROOM_DATA *room, const char *name);
  108. CMD_DATA *roomGetCmd (ROOM_DATA *room, const char *name,
  109. bool abbr_ok);
  110. const char *roomGetClass (ROOM_DATA *room);
  111. void roomSetClass (ROOM_DATA *room, const char *prototype);
  112. void roomSetEdescs (ROOM_DATA *room, EDESC_SET *edescs);
  113. void roomSetName (ROOM_DATA *room, const char *name);
  114. void roomSetDesc (ROOM_DATA *room, const char *desc);
  115. void roomSetTerrain (ROOM_DATA *room, int terrain_type);
  116. void roomSetExtracted (ROOM_DATA *room);
  117. bool roomIsExtracted (ROOM_DATA *room);
  118. //*****************************************************************************
  119. // direction stuff
  120. //*****************************************************************************
  121. const char *dirGetName(int dir);
  122. const char *dirGetAbbrev(int dir);
  123. int dirGetOpposite(int dir);
  124. int dirGetNum(const char *dir);
  125. int dirGetAbbrevNum(const char *dir);
  126. //*****************************************************************************
  127. // terrain stuff
  128. //*****************************************************************************
  129. const char *terrainGetName(int terrain);
  130. int terrainGetNum(const char *terrain);
  131. #endif // __ROOM_H