Re: [Code Help] Abbreviations

From: Benjamin Draper (satrycus@drachenburg.com)
Date: 06/15/00


> Jan Pedersen wrote:
>
> the code compiles fine, but in the game the implementor can use it
> like tell sla(for slayer) message
> but everyone else get this message: No-one by that name here when
> trying to use short names.
>
> anyone have any idea why it dont work with bpl17

 The problem is in get_player_vis() in handler.c, which is called by
get_char_vis() in do_tell. The code snippet below is from Circle30bpl17:

struct char_data *get_player_vis(struct char_data * ch, char *name, int
inroom)
{
  struct char_data *i;

  for (i = character_list; i; i = i->next) {
    if (IS_NPC(i))
      continue;
    if (inroom == FIND_CHAR_ROOM && i->in_room != ch->in_room)
      continue;
    if (str_cmp(i->player.name, name)) /* If not same, continue */
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      continue;
    if (!CAN_SEE(ch, i))
      continue;
    return (i);
  }

  return (NULL);
}

 The line I've marked uses str_cmp to wholly match what a player entered
and the name of the character currently being checked. This will of
course appear to be like stock isname, but you probably won't notice the
problem until you add in the abbreviation snippet. A simple fix is to
change the marked line to:

    if (!isname(name, i->player.name)) /* If not same, continue */

 I first noticed this a couple of patch levels ago, only I forgot to
mention it at the time. It isn't a bug, but wouldn't it make sense to
use isname for the sake of consistency? Obviously George/DAK/Chris
Gilbert, correct me if I'm wrong!

Regards

-> Ben


     +------------------------------------------------------------+
     | 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 : 04/10/01 PDT