flags.c

teeny/db/flags.c · 1.5 KB

From the archive TeenyMUD-1.3.tar.gz

Download the archive   « Back to the archive contents

/* 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);
}

Site Stats

Snippets: 1791
Codebases: 571