Re: [CODE] Verify function

From: George (greerga@CIRCLEMUD.ORG)
Date: 06/26/98


On Thu, 25 Jun 1998, James Turner wrote:

>  static char retbuf[MAX_STRING_LENGTH];

Ouch.  Wouldn't it be better to act like strcpy() than an 8k static buffer?

>  if (rnum == NOWHERE) return NULL;

  Perhaps this should be in the do_verify function since we know beforehand.

>        sprintf(retbuf + strlen(retbuf), "Room %d: going %s then %s doesn't return to starting room\r\n",
>                world[rnum].number, dirs[i], dirs[rev_dir[i]]);

counter += sprintf(retbuf + counter, ....);

Works better than strlen() if you're in a loop.

>      if (TOROOM(rnum, i) == NOWHERE) {
>        sprintf(retbuf + strlen(retbuf), "Room %d: door to the %s leads nowhere\r\n",
>                world[rnum].number, dirs[i]);
>      }

Might also want to check for '< 0 or > top_of_world', just in case.

>  if (a < 0 || b < 0 || a == b) {
>    send_to_char("Usage: verify <first room> <last room>\r\n", ch);
>    return;
>  }

What if you only want to verify one room?

>  for (vfn = 0; vfs[vfn]; vfn++) {
>    for (i = a; i <= b; i++) {

      if ((x = real_room(i)) != NOWHERE)        (Prevent unnecessary call.)

--
George Greer, greerga@circlemud.org | Genius may have its limitations, but
http://patches.van.ml.org/          | stupidity is not thus handicapped.
http://www.van.ml.org/CircleMUD/    |                  -- Elbert Hubbard


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



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