home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / d / d-linux.zip / dm-dist / db.h < prev    next >
C/C++ Source or Header  |  1991-03-01  |  5KB  |  166 lines

  1. /* ************************************************************************
  2. *  file: db.h , Database module.                          Part of DIKUMUD *
  3. *  Usage: Loading/Saving chars booting world.                             *
  4. ************************************************************************* */
  5.  
  6.  
  7. /* data files used by the game system */
  8.  
  9. #define DFLT_DIR          "lib"           /* default data directory     */
  10.  
  11. #define WORLD_FILE        "tinyworld.wld" /* room definitions           */
  12. #define MOB_FILE          "tinyworld.mob" /* monster prototypes         */
  13. #define OBJ_FILE          "tinyworld.obj" /* object prototypes          */
  14. #define ZONE_FILE         "tinyworld.zon" /* zone defs & command tables */
  15. #define CREDITS_FILE      "credits"       /* for the 'credits' command  */
  16. #define NEWS_FILE         "news"          /* for the 'news' command     */
  17. #define MOTD_FILE         "motd"          /* messages of today          */
  18. #define PLAYER_FILE       "players"       /* the player database        */
  19. #define TIME_FILE         "time"          /* game calendar information  */
  20. #define IDEA_FILE         "ideas"         /* for the 'idea'-command     */
  21. #define TYPO_FILE         "typos"         /*         'typo'             */
  22. #define BUG_FILE          "bugs"          /*         'bug'              */
  23. #define MESS_FILE         "messages"      /* damage message             */
  24. #define SOCMESS_FILE      "actions"       /* messgs for social acts     */
  25. #define HELP_KWRD_FILE    "help_table"    /* for HELP <keywrd>          */
  26. #define HELP_PAGE_FILE    "help"          /* for HELP <CR>              */
  27. #define INFO_FILE         "info"          /* for INFO                   */
  28. #define WIZLIST_FILE      "wizlist"       /* for WIZLIST                */
  29. #define POSEMESS_FILE     "poses"         /* for 'pose'-command         */
  30.  
  31. /* public procedures in db.c */
  32.  
  33. void boot_db(void);
  34. void save_char(struct char_data *ch, sh_int load_room);
  35. int create_entry(char *name);
  36. void zone_update(void);
  37. void init_char(struct char_data *ch);
  38. void clear_char(struct char_data *ch);
  39. void clear_object(struct obj_data *obj);
  40. void reset_char(struct char_data *ch);
  41. void free_char(struct char_data *ch);
  42. int real_room(int virtual);
  43. char *fread_string(FILE *fl);
  44. int real_object(int virtual);
  45. int real_mobile(int virtual);
  46.  
  47. #define REAL 0
  48. #define VIRTUAL 1
  49.  
  50. struct obj_data *read_object(int nr, int type);
  51. struct char_data *read_mobile(int nr, int type);
  52.  
  53. #define MENU         \
  54. "\n\rWelcome to DikuMUD\n\r\n\
  55. 0) Exit from DikuMud.\n\r\
  56. 1) Enter the game.\n\r\
  57. 2) Enter description.\n\r\
  58. 3) Read the background story\n\r\
  59. 4) Change password.\n\r\n\r\
  60.    Make your choice: "
  61.  
  62.  
  63. #define GREETINGS \
  64. "\n\r\n\r  \
  65.                            DikuMUD I (GAMMA 0.0)\n\r\n\r \
  66.                               Created by\n\r \
  67.                   Hans Henrik Staerfeldt, Katja Nyboe,\n\r \
  68.            Tom Madsen, Michael Seifert, and Sebastian Hammer\n\r\n\r"
  69.  
  70. #define WELC_MESSG \
  71. "\n\rWelcome to the land of DikuMUD. May your visit here be... Interesting.\
  72. \n\r\n\r"
  73.  
  74.  
  75. #define STORY     \
  76. "This will soon be the background story of DIKU-MUD.\n\r\n\r"
  77.  
  78.  
  79. /* structure for the reset commands */
  80. struct reset_com
  81. {
  82.     char command;   /* current command                      */ 
  83.     bool if_flag;   /* if TRUE: exe only if preceding exe'd */
  84.     int arg1;       /*                                      */
  85.     int arg2;       /* Arguments to the command             */
  86.     int arg3;       /*                                      */
  87.  
  88.     /* 
  89.     *  Commands:              *
  90.     *  'M': Read a mobile     *
  91.     *  'O': Read an object    *
  92.     *  'G': Give obj to mob   *
  93.     *  'P': Put obj in obj    *
  94.     *  'G': Obj to char       *
  95.     *  'E': Obj to char equip *
  96.     *  'D': Set state of door *
  97.     */
  98. };
  99.  
  100.  
  101.  
  102. /* zone definition structure. for the 'zone-table'   */
  103. struct zone_data
  104. {
  105.     char *name;             /* name of this zone                  */
  106.     int lifespan;           /* how long between resets (minutes)  */
  107.     int age;                /* current age of this zone (minutes) */
  108.     int top;                /* upper limit for rooms in this zone */
  109.  
  110.     int reset_mode;         /* conditions for reset (see below)   */
  111.     struct reset_com *cmd;  /* command table for reset               */
  112.  
  113.     /*
  114.     *  Reset mode:                              *
  115.     *  0: Don't reset, and don't update age.    *
  116.     *  1: Reset if no PC's are located in zone. *
  117.     *  2: Just reset.                           *
  118.     */
  119. };
  120.  
  121.  
  122.  
  123.  
  124. /* element in monster and object index-tables   */
  125. struct index_data
  126. {
  127.     int virtual;    /* virtual number of this mob/obj           */
  128.     long pos;       /* file position of this field              */
  129.     int number;     /* number of existing units of this mob/obj    */
  130.     int (*func)();  /* special procedure for this mob/obj       */
  131. };
  132.  
  133.  
  134.  
  135.  
  136. /* for queueing zones for update   */
  137. struct reset_q_element
  138. {
  139.     int zone_to_reset;            /* ref to zone_data */
  140.     struct reset_q_element *next;    
  141. };
  142.  
  143.  
  144.  
  145. /* structure for the update queue     */
  146. struct reset_q_type
  147. {
  148.     struct reset_q_element *head;
  149.     struct reset_q_element *tail;
  150. } reset_q;
  151.  
  152.  
  153.  
  154. struct player_index_element
  155. {
  156.     char *name;
  157.     int nr;
  158. };
  159.  
  160.  
  161. struct help_index_element
  162. {
  163.     char *keyword;
  164.     long pos;
  165. };
  166.