TinyMAZE/
TinyMAZE/config/
TinyMAZE/doc/
TinyMAZE/run/msgs/
TinyMAZE/src/
TinyMAZE/src/db/
TinyMAZE/src/ident/
TinyMAZE/src/io/
TinyMAZE/src/prog/
TinyMAZE/src/softcode/
TinyMAZE/src/util/
#ifndef _MUSE_DB_H
#define _MUSE_DB_H

#include <time.h>
#include "config.h"
#include "attrib.h"
#include "powers.h"
#include "hash.h"

#define stack_alloc(x, y, z) \
  (stack_alloc2(__FILE__, __LINE__, x, y, z))
#define stack_realloc(x, y) \
  (stack_realloc2(__FILE__, __LINE__, x, y, 0))
#define stack_realloc_tmp(x, y) \
  (stack_realloc2(__FILE__, __LINE__, x, y, 1))
#define stack_string_alloc(x, y) \
  (stack_string_alloc2(__FILE__, __LINE__, x, y))
#define stack_string_realloc(x, y) \
  (stack_string_realloc2(__FILE__, __LINE__, x, y, 0))
#define stack_string_realloc_tmp(x, y) \
  (stack_string_realloc2(__FILE__, __LINE__, x, y, 1))
#define stack_free(x) \
  (stack_free2(__FILE__, __LINE__, x, 0))
#define stack_free_tmp(x) \
  (stack_free2(__FILE__, __LINE__, x, 1))

/* Flag definitions */

#define TYPE_MASK 	 0xF  /* To mask type from rest of flags */
#define TYPE_ROOM 	 0x1
#define TYPE_THING 	 0x2
#define TYPE_EXIT 	 0x4
#define TYPE_PLAYER	 0x8
#define NOTYPE           0xF  /* Mask for any type */

#define CHOWN_OK	 0x20
#define DARK		 0x40	/* contents of room are not printed */
#define	HAVEN		 0x80	/* object can't execute commands */
#define INHERIT_POWERS	 0x100	/* gives object powers of its owner */
#define PUPPET		 0x200
#define VISIBLE		 0x400
#define OPAQUE		 0x800
#define QUIET		 0x1000
#define NOMODIFY         0x2000

/* TYPE-specific flags */

/* Thing flags */
#define THING_LIGHT	 0x4000

/* Exit flags */
#define EXIT_LIGHT	 0x4000

/* Player flags */
#define PLAYER_NEWBIE	 0x4000
#define PLAYER_SLAVE	 0x8000
#define PLAYER_MORTAL	 0x10000
#define PLAYER_ANSI	 0x20000
#define PLAYER_INVISIBLE 0x40000
#define PLAYER_TERSE	 0x80000
#define PLAYER_NO_WALLS	 0x100000
#define PLAYER_SUSPECT   0x200000
#define PLAYER_NO_COM	 0x400000
#define PLAYER_NO_ANN	 0x800000

/* Room flags */
#define ROOM_FLOATING	0x10000

/* Flags to be used with the flags2 member */

/* End of flags */

/* macro to make set string easier to use */

/* Attribute access macros */                     
#define Osucc(thing) atr_get(thing, "OSUCC")
#define Ofail(thing) atr_get(thing, "OFAIL")
#define Fail(thing) atr_get(thing, "FAIL")
#define Succ(thing) atr_get(thing, "SUCC")
#define Pass(thing) atr_get(thing, "PASSWORD")
#define Desc(thing) atr_get(thing, "DESC")
#define Idle(thing) atr_get(thing, "IDLE")
#define Away(thing) atr_get(thing, "AWAY")
#define Pennies(thing) atol(atr_get(thing, "PENNIES"))

extern char *int_to_str();

/* We need this for saving dbref numbers during the db load. */
/* The list is freed on each object when the load is complete. */
struct db_load_info
{
  int location;
  int *contents;
  int *exits;
  int link;
  int owner;
  int creator;
};

typedef struct object OBJ;

struct object
{
  unsigned long flags;
  unsigned long flags2;
  char *name;
  OBJ *location;
  OBJ *contents;
  OBJ *next_con;
  OBJ *exits;
  OBJ *next_exit;
  OBJ *link;
  struct mail_struct *mail;
  int *pows;
  int class;
  OBJ *owner;
  time_t mod_time;
  time_t create_time;
  struct program_struct *program;
  OBJ *creator;
  int dbref;
  ALIST *attrlist;
  CALIAS *comm_aliases;
  struct db_load_info *loadinfo;

  OBJ *next;
};

extern OBJ *player_list;
extern OBJ *thing_list;
extern OBJ *room_list;
extern OBJ *exit_list;

extern OBJ *root_obj;
extern OBJ *player_start_obj;

extern OBJ **db_list;

extern int db_top;

/* For color routines... */
#define ADD 1
#define REMOVE 0

#endif /* _MUSE_DB_H */