#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "struct.h"
/*
* Function replacements for our rather out of control macros
*/
int mac_IsItem(x)
tag x;
{
if(ItemArray[OBJ(x)]==NULL)
return(0);
return(1);
}
int mac_Valid(x)
tag x;
{
if(OBJ(x)>=0&&OBJ(x)<=VAL(NObs()))
return(1);
return(0);
}
void log_error(char *a,...)
{
va_list b;
va_start(b,a);
if(Booted)
ReportLines();
vfprintf(stderr,a,b);
fflush(stderr);
va_end(b);
}
struct Object *mac_Object(x)
tag x;
{
if(mac_Valid(x)==0)
{
log_error("Invalid item '%d'\n",x);
panic();
}
return(ItemArray[x]);
}
struct Player *mac_Player(x)
tag x;
{
return((struct Player *)mac_Object(x));
}
struct Room *mac_Room(x)
tag x;
{
return((struct Room *)mac_Object(x));
}
tag VAL(x)
tag x;
{
return(x);
}