Re: Circle: the DOT bug.

From: Belgian Underground Mud (bug@asteriks.rug.ac.be)
Date: 04/24/95


> I don't suppose any have fixed up the DOT bug that seems to be
> standard with the base circle release?

nod.

I also added name abbreving. You must make is_abbrev antisymmetrical, ie 
add a if (*arg1) return 0; or something like that at the end.

Take care: You must reverse the order of some is_abbrev check in the code 
too.... the first arg is the abbrev, so not is_abbrev("pingu", "ping") 
but ("ping", "pingu")

/* ************************************************************************
*   File: handler.c                                     Part of CircleMUD *

/* ***********************************************************************
   Here follows high-level versions of some earlier routines, ie functions
   which incorporate the actual player-data.
   *********************************************************************** */

/* Gekke: changed stuff so that player names can be abbreviated*/
/* And fixed a bug introduced by JE: You could do see .<name> if you were
 * not in the same room! */
struct char_data *get_player_room_vis(struct char_data *ch, char *name)
{
  struct char_data *i, *j;
  int n=0;

  for (i = world[ch->in_room].people; i && n<2; i = i->next_in_room)
    if (!IS_NPC(i) && is_abbrev(name, i->player.name) && CAN_SEE(ch, i)) {
      j=i;
      n++;
    }

  if (n==1)
    return j;

  return NULL;
}

struct char_data *get_player_vis(struct char_data *ch, char *name)
{
  struct char_data *i, *j;
  int n=0;

  for (i = character_list; i && n<2; i = i->next)
    if (!IS_NPC(i) && is_abbrev(name, i->player.name) && CAN_SEE(ch, i)) {
      j=i;
      n++;
    }

  if (n==1)
    return j;

  return NULL;
}


struct char_data *get_char_room_vis(struct char_data * ch, char *name)
{
  struct char_data *i;
  int j=0, number;
  char tmpname[MAX_INPUT_LENGTH];
  char *tmp = tmpname;

  /* JE 7/18/94 :-) :-) */
  if (!str_cmp(name, "self") || !str_cmp(name, "me"))
    return ch;

  /* 0.<name> means PC with name */
  strcpy(tmp, name);
  if (!(number = get_number(&tmp)))
    return get_player_room_vis(ch, tmp);

  for (i = world[ch->in_room].people; i && j <= number; i = i->next_in_room)
    if (CAN_SEE(ch, i) && isname(tmp, i->player.name) && ++j == number)
      return i;

  return NULL;
}



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