Re: [NEWBIE][CODE] help with dig command

From: George Greer (greerga@circlemud.org)
Date: 05/05/99


On Wed, 5 May 1999, Christopher J. Bottaro wrote:

>        static const char* dir_name[] = {"North", "East", "South", "West", "Up",
>"Down"};

This duplicates dirs[] in constants.c

>        static const char* rdir_name[] = {"South", "West", "North", "East",
>"Down", "Up"};

This duplicates dirs[rev_dir[]]

>        char buf1[10],buf2[10];

Those are pretty small.  People will be able to crash your MUD at will.

>        for (dir = 0;dir < NUM_OF_DIRS;dir++)   {
>                if (is_match(buf1,dir_name[dir]))
>                        break;
>        }

That's what search_block() is for.

>        //find reverse direction
>        for (rdir = 0;rdir < NUM_OF_DIRS;rdir++)        {
>                if (is_match(buf1,rdir_name[rdir]))
>                        break;
>        }

rdir = rev_dir[dir], unless you want people to dig exits east and connect
to the south.

Crash isn't obvious to me currently, but I just woke up...

--
George Greer            | CircleMUD Snippets
greerga@circlemud.org   | http://developer.circlemud.org/snippets/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST