Well, I have a very important question. I run a MUD derived off of SWR and I've fixed almost every bug I've found, except for this one. When a person logs in and it says "Please choose a main ability from the following classes" and then if they type ee or something like that it crashes. So I guess I'll just try and post the code here (only the section I know the bug is in) and hope you can find what I'm looking for. I'm not really an experienced coder, but I know enough for what I need. Only this one bug has slipped my mind, I'm not good at working with arguments really. So please post a reply if you can help. Sorry if the format is screwed up a bit, I copy and pasted it.
------ From void nanny in comm.c ------
write_to_buffer( d, "\n\rPlease choose a main ability from the folowing classes:\n\r[", 0 );
buf[0] = '\0';
for ( iClass = 0; iClass < MAX_ABILITY; iClass++ )
{
if (ability_name[iClass] && ability_name[iClass][0] != '\0')
{
if ( iClass > 0 )
{
if ( strlen(buf)+strlen(ability_name[iClass]) > 77 )
{
strcat( buf, "\n\r" );
write_to_buffer( d, buf, 0 );
buf[0] = '\0';
}
else
strcat( buf, " " );
}
strcat( buf, ability_name[iClass] );
}
}
strcat( buf, "]\n\r: " );
write_to_buffer( d, buf, 0 );
d->connected = CON_GET_NEW_CLASS;
break;
case CON_GET_NEW_CLASS:
argument = one_argument(argument, arg);
if (!str_cmp( arg, "help") )
{
do_help(ch, argument);
write_to_buffer( d, "Please choose an ability class: ", 0);
return;
}
for ( iClass = 0; iClass < MAX_ABILITY; iClass++ )
{
if ( toupper(arg[0]) == toupper(ability_name[iClass][0])
&& !str_prefix( arg, ability_name[iClass] ) )
{
ch->main_ability = iClass;
break;
}
}
if ( iClass == MAX_ABILITY
|| !ability_name[iClass] || ability_name[iClass][0] == '\0')
{
write_to_buffer( d,
"That's not a skill class.\n\rWhat IS it going to be? ", 0 );
return;
}
|