Valid_Name bug fix

From: Ben Cartwright (
Date: 09/02/00

From ChangeLog:
> 1/16/98
> -- gg - interpreter.c/ban.c: nanny()/Valid_Name(): Fixed the long-standing
>      Diku bug where you could create two characters with the same name by
>      proceeding one step at a time in two different sessions.

   I don't know if anyone's noticed this before, but the above bug fix
caused another bug to pop up.  If you log on a character, but do not enter
the game, (sit on the menu, change description, change password, etc) then
you will be unable to connect to the mud with the same name in a different
window, it will say "Invalid Name".  Thus, it's possible (and I've done this,
once ;-) ) to lock yourself out of your character by having your link
freeze up when you're at the menu, and then attempting to reconnect.
   "Having your link freeze up" being defined as: the mud thinks the
descriptor is still valid, despite you loosing connection, and doesn't
destroy it.

   The fix I used is to modify the Valid_Name function in ban.c.  The code:

  for (dt = descriptor_list; dt; dt = dt->next)
    if (dt->character && GET_NAME(dt->character) && !str_cmp(GET_NAME(dt->character), newname))
      return (STATE(dt) == CON_PLAYING);

   Should be replaced with:

  /* New, unindexed characters (i.e., characters who are in the process of creating)
   * will have an idnum of -1, set by clear_char() in db.c.  If someone is creating a
   * character by the same name as the one we are checking, then the name is invalid,
   * to prevent character duping.
  for (dt = descriptor_list; dt; dt = dt->next)
    if (dt->character && GET_NAME(dt->character) && !str_cmp(GET_NAME(dt->character), newname))
      if (GET_IDNUM(dt->character) == -1)
        return (0);

   If anyone's encountered this bug before, hope this helps.

-- Ben C

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/11/01 PDT