/****************************************************************************
* [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame | \\._.// *
* -----------------------------------------------------------| (0...0) *
* SMAUG 1.4 (C) 1994, 1995, 1996, 1998 by Derek Snider | ).:.( *
* -----------------------------------------------------------| {o o} *
* SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus, | / ' ' \ *
* Scryn, Rennard, Swordbearer, Gorog, Grishnakh, Nivek, |~'~.VxvxV.~'~*
* Tricops and Fireblade | *
* ------------------------------------------------------------------------ *
* Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* ------------------------------------------------------------------------ *
* Main structure manipulation module *
****************************************************************************/
#include <stdio.h>
#include <string.h>
#include "mud.h"
int umin( int check, int ncheck )
{
if( check < ncheck )
return check;
return ncheck;
}
int umax( int check, int ncheck )
{
if( check > ncheck )
return check;
return ncheck;
}
int urange( int mincheck, int check, int maxcheck )
{
if( check < mincheck )
return mincheck;
if( check > maxcheck )
return maxcheck;
return check;
}
/* See if a string is one of the names of an object. */
bool is_name( const char *str, const char *namelist )
{
char name[MAX_INPUT_LENGTH];
for( ;; )
{
namelist = one_argument( namelist, name );
if( name[0] == '\0' )
return false;
if( !str_cmp( str, name ) )
return true;
}
}
/* Return ascii name of pulltype exit setting. */
const char *pull_type_name( int pulltype )
{
if( pulltype >= PT_FIRE )
return ex_pfire[pulltype - PT_FIRE];
if( pulltype >= PT_AIR )
return ex_pair[pulltype - PT_AIR];
if( pulltype >= PT_EARTH )
return ex_pearth[pulltype - PT_EARTH];
if( pulltype >= PT_WATER )
return ex_pwater[pulltype - PT_WATER];
if( pulltype < 0 )
return "ERROR";
return ex_pmisc[pulltype];
}
/* Remove an exit from a room -Thoric */
void extract_exit( ROOM_INDEX_DATA * room, EXIT_DATA * pexit )
{
UNLINK( pexit, room->first_exit, room->last_exit, next, prev );
if( pexit->rexit )
pexit->rexit->rexit = NULL;
STRFREE( pexit->keyword );
STRFREE( pexit->description );
DISPOSE( pexit );
}