Re: [code] player/mob names snippet

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


On Mon, 8 Jun 1998, Sammy wrote:

>  strcpy(tmp, name);
>  if (!(number = get_number(&tmp)))
>    return get_player_vis(ch, tmp, 0);
>
>  /* check players first */
>  for (d = descriptor_list; d && (j <= number); d = d->next)
>    if (d->character && isname(tmp, d->character->player.name)
>        && CAN_SEE(ch, d->character))
>      if (++j == number)
>        return d->character;

Um...that's what 'get_player_vis' does.  It's just that in this case,
'get_player_vis' is only called if you type '0.name'. It's a feature
because it's documented. :)

So really, just call get_player_vis always and check the result.

--
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