Posting the code around where you believe it is crashing at is more
helpful than just saying "there's a bug in my code!" like some people do,
but what would be really helpful is the exact line it crashed on.
I would guess it's probably not one of the lines you posted below,
but a function called by one of these lines that is crashing.
I didn't look through it in too much detail, but I didn't see anything
horribly wrong popping out at me.
Learn to use gdb. It is your friend. It might seem like a lot of work
to learn how to use it, but it will end up costing much less time and
effort in the long run than not learning it.
Dennis
On Sun, 31 Mar 2002, Zeio wrote:
> Ok, everything was going great, until I added in the rather simple (or so I
> thought) ansi login/greeting to my nanny function.
>
> Right now, I can log in as existing characters with the Do You want ANSI
> prompt just fine, but when I attempt to create a new character, select my
> race, and then when it prompts for the sex of the character in GET_NEW_SEX
> it crashes the mud.
>
> I'm really not sure why, as I didnt change anything in the process of adding
> in the ansi login to the CON GET NEW RACE or CON GET NEW SEX.
>
> Here is my code line 2079 - 2132:
>
> /* add cost */
> ch->pcdata->points = pc_race_table[race].points;
> ch->size = pc_race_table[race].size;
>
> write_to_buffer( d, "What is your sex (M/F)? ", 0 );
> d->connected = CON_GET_NEW_SEX;
> break;
>
>
> case CON_GET_NEW_SEX:
> switch ( argument[0] )
> {
> case 'm': case 'M': ch->sex = SEX_MALE;
> ch->pcdata->true_sex = SEX_MALE;
> break;
> case 'f': case 'F': ch->sex = SEX_FEMALE;
> ch->pcdata->true_sex = SEX_FEMALE;
> break;
> default:
> write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 );
> return;
> }
>
> /* Class Listing Menu fiz */
> sprintf(buf, "%s\n\r------------------------------[",C_WHITE);
> send_to_char(buf,ch);
> sprintf(buf, "%s Classes Available ",C_B_WHITE);
> send_to_char(buf,ch);
> sprintf(buf, "%s]-----------------------------\n\r\n\r",C_WHITE);
> send_to_char(buf,ch);
> do_function(ch, &do_help,"cmenu");
> sprintf(buf,
> "%s-------------------------------------------------------------------------
> -------\n\r",C_WHITE);
> send_to_char(buf,ch);
> /* Reset Color (green) fiz */
> sprintf(buf, "%s",CLEAR);
> send_to_char(buf,ch);
>
> strcpy( buf, "Select a class [" );
> for ( iClass = 0; iClass < MAX_CLASS; iClass++ )
> {
> if (!class_table[iClass].remort_class ||
> (class_table[iClass].remort_class && IS_SET(ch->act,PLR_REMORT)))
> {
> if ( iClass > 0 )
> strcat( buf, " " );
> strcat( buf, class_table[iClass].name );
> }
> }
> strcat( buf, "]: " );
> write_to_buffer( d, buf, 0 );
> d->connected = CON_GET_NEW_CLASS;
> break;
>
> case CON_GET_NEW_CLASS:
>
>
>
> Is there anything visibily incorrect in the above lines? or could it be due
> to something else. It compiles fine, so I'm kinda lost. Any help would be
> appreciated.
>
> Thanks
> -Zeio
>
>
>