/
teeny/db/
teeny/dbm/
teeny/docs/
teeny/includes/
teeny/misc/
teeny/news/
teeny/text/
/* flags.c */

#include "copyright.h"
#include "config.h"

#ifndef NULL
#include <stdio.h>
#endif

#include "teeny.h"
#include "db.h"

extern struct dsc **main_index;
extern int      total_objects;

int 
is_flag_set(obj, code)
  int             obj;
  int             code;
{

  if (obj < 0 || obj >= total_objects || main_index[obj] == NULL)
  {
    warning("is_flag_set", "bad obj passed as an argument");
    return 0;
  }
  return ((DSC_FLAGS(main_index[obj]) & code));
}

int 
isplayer(obj)
  int             obj;
{

  if (obj < 0 || obj >= total_objects || main_index[obj] == NULL)
  {
    warning("isplayer", "bad obj passed as an argument");
    return 0;
  }
  return (PlayerP(main_index[obj]));
}

int 
isroom(obj)
  int             obj;
{

  if (obj < 0 || obj >= total_objects || main_index[obj] == NULL)
  {
    warning("isroom", "bad obj passed as an argument");
    return 0;
  }
  return (RoomP(main_index[obj]));
}

int 
isexit(obj)
  int             obj;
{

  if (obj < 0 || obj >= total_objects || main_index[obj] == NULL)
  {
    warning("isexit", "bad obj passed as an argument");
    return 0;
  }
  return (ExitP(main_index[obj]));
}

int 
isthing(obj)
  int             obj;
{

  if (obj < 0 || obj >= total_objects || main_index[obj] == NULL)
  {
    warning("isthing", "bad obj passed as an argument");
    return 0;
  }
  return (ThingP(main_index[obj]));
}

int 
isgarbage(obj)
  int             obj;
{

  return (obj >= 0 && obj < total_objects && main_index[obj] == NULL);
}