act_move.c
Converter/src/act_move.c · 2.3 KB
From the archive converter.tgz
Download the archive « Back to the archive contents
/****************************************************************************
* [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. *
* ------------------------------------------------------------------------ *
* Player movement module *
****************************************************************************/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "mud.h"
const char *const dir_name[] = {
"north", "east", "south", "west", "up", "down",
"northeast", "northwest", "southeast", "southwest", "somewhere"
};
const short rev_dir[] = {
2, 3, 0, 1, 5, 4, 9, 8, 7, 6, 10
};
/*
* Function to get the equivelant exit of DIR 0-MAXDIR out of linked list.
* Made to allow old-style diku-merc exit functions to work. -Thoric
*/
EXIT_DATA *get_exit( ROOM_INDEX_DATA * room, short dir )
{
EXIT_DATA *xit;
if( !room )
{
bug( "%s", "Get_exit: NULL room" );
return NULL;
}
for( xit = room->first_exit; xit; xit = xit->next )
if( xit->vdir == dir )
return xit;
return NULL;
}
/*
* Function to get an exit, leading the the specified room
*/
EXIT_DATA *get_exit_to( ROOM_INDEX_DATA * room, short dir, int vnum )
{
EXIT_DATA *xit;
if( !room )
{
bug( "%s", "Get_exit: NULL room" );
return NULL;
}
for( xit = room->first_exit; xit; xit = xit->next )
if( xit->vdir == dir && xit->vnum == vnum )
return xit;
return NULL;
}