zone.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef __ZONE_H
  2. #define __ZONE_H
  3. //*****************************************************************************
  4. //
  5. // zone.h
  6. //
  7. // A zone is like a stand-alone module, or encounter, within the game (e.g.
  8. // a city in the world), and contains all of the NPCs, objects, rooms, scripts,
  9. // etc... needed for the zone to be complete.
  10. //
  11. //*****************************************************************************
  12. //
  13. // Create a new zone, with vnums bounded between (inclusive) min and max
  14. ZONE_DATA *newZone(const char *key);
  15. //
  16. // Delete a zone, plus all of the prototypes contained within.
  17. // CONSIDERATION: Should we delete rooms as well, and deposit
  18. // players into some sort of limbo, or should
  19. // we leave rooms as-is? I think we should probably
  20. // delete the rooms, and deposit the players in a
  21. // room that is known to always exist (limbo?)
  22. void deleteZone(ZONE_DATA *zone);
  23. //
  24. // Load a zone from disk.
  25. ZONE_DATA *zoneLoad(WORLD_DATA *world, const char *key);
  26. //
  27. // Save a zone to the specified directory path
  28. bool zoneSave(ZONE_DATA *zone);
  29. //
  30. // Pulse a zone. i.e. decrement it's reset timer. When the timer hits 0,
  31. // set it back to the max, and reset everything in the zone
  32. void zonePulse(ZONE_DATA *zone);
  33. void zoneForceReset(ZONE_DATA *zone);
  34. //
  35. // Copy zone-specific data, but not contents in the zone (no rooms, mobs
  36. // objs, scripts, etc)
  37. ZONE_DATA *zoneCopy(ZONE_DATA *zone);
  38. void zoneCopyTo(ZONE_DATA *from, ZONE_DATA *to);
  39. //*****************************************************************************
  40. // get and set functions for zones
  41. //*****************************************************************************
  42. //
  43. // various get functions for zones
  44. int zoneGetPulseTimer(ZONE_DATA *zone);
  45. int zoneGetPulse(ZONE_DATA *zone);
  46. WORLD_DATA *zoneGetWorld(ZONE_DATA *zone);
  47. const char *zoneGetName(ZONE_DATA *zone);
  48. const char *zoneGetDesc(ZONE_DATA *zone);
  49. const char *zoneGetEditors(ZONE_DATA *zone);
  50. BUFFER *zoneGetDescBuffer(ZONE_DATA *zone);
  51. void *zoneGetAuxiliaryData(const ZONE_DATA *zone, char *name);
  52. LIST *zoneGetResettable(ZONE_DATA *zone);
  53. //
  54. // various set functions for zones
  55. void zoneSetPulseTimer(ZONE_DATA *zone, int timer);
  56. void zoneSetPulse(ZONE_DATA *zone, int pulse_left);
  57. void zoneSetWorld(ZONE_DATA *zone, WORLD_DATA *world);
  58. void zoneSetName(ZONE_DATA *zone, const char *name);
  59. void zoneSetDesc(ZONE_DATA *zone, const char *description);
  60. void zoneSetEditors(ZONE_DATA *zone, const char *names);
  61. //
  62. // stuff for editing different prototypes stored in zones
  63. void zoneSetKey(ZONE_DATA *zone, const char *key);
  64. const char *zoneGetKey(ZONE_DATA *zone);
  65. void *zoneGetType(ZONE_DATA *zone, const char *type, const char *key);
  66. void *zoneRemoveType(ZONE_DATA *zone, const char *type, const char *key);
  67. void zoneSaveType(ZONE_DATA *zone, const char *type, const char *key);
  68. void zonePutType(ZONE_DATA *zone, const char *type, const char *key,
  69. void *data);
  70. void zoneAddType(ZONE_DATA *zone, const char *type, void *reader,
  71. void *storer, void *deleter, void *keysetter);
  72. LIST *zoneGetTypeKeys(ZONE_DATA *zone, const char *type);
  73. //
  74. // some types can 'forget' what they are. This is a fudge so Python can add
  75. // types to zones, and we can do a lookup on the functions that need to
  76. // be called, without having to explicitly deal with Python in zone.c.
  77. // Forgetful functions are exactly the same as normal functions, except they
  78. // take an additional initial argument, which is a const string of their type
  79. void zoneAddForgetfulType(ZONE_DATA *zone, const char *type, void *reader,
  80. void *storer, void *deleter, void *keysetter);
  81. #endif // __ZONE_H