Re: [Code][Newbie] Set Name.. yeah yeah.

From: George Greer (greerga@circlemud.org)
Date: 10/28/99


On Thu, 28 Oct 1999, Emil Nilimaa wrote:

>---------------------------------------------------------
>case 56:
>
>SET_BIT(PLR_FLAGS(vict), PLR_DELETED);
>save_char(vict, NOWHERE);
>
>free(vict->player.name);
>vict->player.name = NULL;
>
>vict->player.name = val_arg;
>vict->player.name = str_dup(val_arg);
>strcpy(vict->player.name, CAP(val_arg));
>
>
>GET_PFILEPOS(vict) = create_entry(GET_PC_NAME(vict));
>
>
>send_to_char("Your name has been changed.\r\n", vict);
>send_to_char("Name Changed.\r\n", ch);
>save_char(vict, NOWHERE);
>build_player_index();
>
>break;

In my old MUD, I used:

  case 52:
    if (IS_MOB(vict)) {
      if (vict->player.short_descr != mob_proto[vict->nr].player.short_descr)
        FREE(vict->player.short_descr);
      vict->player.short_descr = STR_DUP(val_arg);
    } else {
      FREE(GET_NAME(vict));
      vict->player.name = STR_DUP(val_arg);
      if ((i = find_name(GET_NAME(vict))) >= 0) {
        FREE(player_table[i].name);
        player_table[i].name = STR_DUP(val_arg);
      }
    }
    break;

(FREE = free, STR_DUP = str_dup; for your purpose.)

It looks like I fixed it to update the player table but I don't remember
doing that specifically.  That was written for bpl12 so you may need to
change it a bit.

--
George Greer            | CircleMUD Snippets
greerga@circlemud.org   | http://developer.circlemud.org/snippets/


     +------------------------------------------------------------+
     | 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 : 12/15/00 PST