Re: Rename char function

From: Tim Skinner (df109@CITY.AC.UK)
Date: 10/22/98


As george said it's nice and easy to use set to perform said function.
The immediate problems with the below which spring to mind are entirely related
to the files associated with a player (ie plrobjs and plraliases) - namely that
this code does not broach the subject of renaming these files to the players
new name but that can be left as an exercise for the reader :)

  case 107:
    max_length = MAX_NAME_LENGTH;
    if (GET_LEVEL(ch) < LVL_BOSS) {
      send_to_char("Hmm no I don't think you should.", ch);
      return;
    }
    /* Convert to lower case and check for illegal characters */
    for(c=val_arg;*c;c++) {
      max_length--;
      *c = LOWER(*c);
      if (!isalpha(*c)) {
        send_to_char("A player name must have no spaces, numbers or punctuation.
\r\n", ch);
        return;
      }
    }
    if (max_length < 0) {
      send_to_char("That's too long for a player name.\r\n", ch);
      return;
    }
    /* Check for an exisiting player */
    if (find_name(val_arg) != -1) {
      send_to_char("There is already a player with this name.\r\n", ch);
      return;
    }
    /* Warn about the name change, and make sure 1st is caps */
    send_to_char("You have changed the name of a player : forcing save.\n\r", ch
);
    if (islower(*val_arg)) *val_arg = toupper(*val_arg);
    vict->player.name = str_dup(val_arg);
    /* Save it to update the indexes */
    save_char(vict, NOWHERE);
    break;

--

"Would you tell me, please, which way I ought to go from here?"
"That depends a good deal on where you want to get to," said the Cat.
"I don't much care where-" said Alice.
"Then it doesn't matter which way you go," said the Cat.
"-so long as I get _somewhere_," Alice added as an explanation.
"Oh, you're sure to do that," said the Cat, "if only you walk long enough."


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