[Circle] [Code] [Newbie?] Implementing last names...

From: Lt. M. DeVelaine (develaine@uss.corsair.org)
Date: 11/23/96


I'm trying to add the ability for players to give their characters last
names. The code I've added compiled fine last night, but during
character creation I get a core dump. Since I'm taking a crash course in
C programming (I know, not a good idea, but I have experience with other
languages), I'm assuming that my error is something that I've
overlooked.

This is the sectoin I added to interpreter.c:

    SEND_TO_Q("\r\nDo you want a last name? (y/N) ", d);
    if (UPPER(*arg) == 'Y') {
       SEND_TO_Q("\r\nEnter your character's last name: ", d);
       STATE(d) = CON_QLAST;
    } else
       STATE(d) = CON_QCLASS;
    break;

  case CON_QLAST:
    tmp_name = *arg; /* This is the problem line during last compile.*/
    if (!Valid_Name(tmp_name)) {
       SEND_TO_Q("Invalid name. Please try another.\r\n", d);
       SEND_TO_Q("Last name: ", d);
       return;
    }
    if (!*arg) {
       SEND_TO_Q("Make up your mind.\r\n", d);
       SEND_TO_Q("Do you or do you not want a last name? (y/N) ", d);
       if (UPPER(*arg) == 'Y') {
	  SEND_TO_Q("\r\nEnter your last name: ", d);
	  STATE(d) = CON_QLAST;
       } else
	  STATE(d) = CON_QCLASS;
       break;
    }
    strcpy(d->character->player.lname, tmp_name);
    SEND_TO_Q(class_menu, d);
    SEND_TO_Q("\r\nClass: ", d);
    STATE(d) = CON_QCLASS;
    break;

Any ideas on a fix would be helpful. If anyone needs to see the other
changes, I'll be glad to send them, but I doubt they'd be necessary,
seeing as it was mostly set-up mirroring "name" and "GET_x(ch)"
#defines.

-- 
Thomas Burns <develaine@geocities.com>
"What the hell do I know about <insert subject here>?"
Lt. Marquinn DeVelaine @ TrekMuse <telnet trekmuse.org 1701>
Chelder Drenastar on various MUDs.
My completely useless homepage:
http://www.geocities.com/TimesSquare/7505/
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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