/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
#include <glib.h>
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <merc.h>
#include <recycle.h>
#include <olc.h>
#include <interp.h>
#include <fight.h>
#include <tables.h>
extern bool fBootDb;
/*
* Translates mob virtual number to its room index struct.
* Hash table lookup.
*/
ROOM_INDEX_DATA *get_room_index( int vnum )
{
ROOM_INDEX_DATA *pRoomIndex;
for ( pRoomIndex = room_index_hash[vnum % MAX_KEY_HASH];
pRoomIndex != NULL;
pRoomIndex = pRoomIndex->next )
{
if ( pRoomIndex->vnum == vnum )
return pRoomIndex;
}
if ( fBootDb )
{
bug( "Get_room_index: bad vnum %d.", vnum );
exit( 1 );
}
return NULL;
}
MPROG_CODE *get_mprog_index( int vnum )
{
MPROG_CODE *prg;
for( prg = mprog_list; prg; prg = prg->next )
{
if ( prg->vnum == vnum )
return( prg );
}
return NULL;
}
/*
* Get an extra description from a list.
*/
char *get_extra_descr( char *name, EXTRA_DESCR_DATA *ed )
{
for ( ; ed != NULL; ed = ed->next )
{
if ( is_name( name, ed->keyword ) )
return ed->description;
}
return NULL;
}