Snoop modification

From: Tyler (Sorren1@GEOCITIES.COM)
Date: 02/26/98


Can anyone see any problems with my code.  Any foreseeable things that
would cause my mud to crash.  If you wish to use it, please tell me
if it works for you, or any modifications you make to improve this.
My character generation is alittle lengthy, and there are some problems
that I cannot seem to pinpoint with the debugger, hence this code.
This little mod is based on bpl12

/* add this in handler.c somewhere near the get_char* */
struct char_data *get_char_anywhere(CHAR_DATA *ch, char *name) {
  DESC_DATA *d = NULL;
  int j = 0, number;
  char tmpname[MAX_INPUT_LENGTH];
  char *tmp = tmpname;

  strcpy(tmp, name);
  number = get_number(&tmp);

  for (d = descriptor_list;d && (j <= number); d=d->next) {
        if (d->character == NULL)
                continue;
        if (!d->character->desc)
                continue;
        if (isname(tmp, d->character->player.name))
                if (++j == number)
                        return d->character;
  }
return NULL;
}

/* add this in handler.h near the other get_char* */
struct char_data *get_char_anywhere(CHAR_DATA *ch, char *name);

/* change this in act.wizard.c */

ACMD(do_snoop)
{
  struct char_data *victim, *tch;

  if (!ch->desc)
    return;

  one_argument(argument, arg);

  if (!*arg)
    stop_snooping(ch);
/* change next line from this to
  else if (!(victim = get_char_vis(ch, arg))) */
/* this */
  else if (!(victim = get_char_anywhere(ch, arg)))
/* end of mod */
    send_to_char("No such person around.\r\n", ch);
  else if (!victim->desc)
    send_to_char("There's no link.. nothing to snoop.\r\n", ch);
  else if (victim == ch)
    stop_snooping(ch);
  else if (victim->desc->snoop_by)
    send_to_char("Busy already. \r\n", ch);
  else if (victim->desc->snooping == ch->desc)
    send_to_char("Don't be stupid.\r\n", ch);
  else {
    if (victim->desc->original)
      tch = victim->desc->original;
    else
      tch = victim;


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