i added the bank code to my smaugfuss, and every time i try to withdraw my mud crashes. i can deposit and balance ok. i looked through the withdraw code, but i'm not sure what's wrong.
upon further testing, i can't go over 3 places. i can withdraw 2 gold, 20 gold, 200 gold, but if i go for 2000 gold it crashes.
void do_withdraw( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *banker;
char arg1[MAX_INPUT_LENGTH];
char buf [MAX_STRING_LENGTH];
int amount;
if ( !( banker = find_banker( ch ) ) )
{
send_to_char( "You're not in a bank!\n\r", ch );
return;
}
if ( IS_NPC( ch ) )
{
sprintf( buf, "Sorry, %s, we don't do business with mobs.", ch->short_descr );
do_say( banker, buf );
return;
}
if ( argument[0] == '\0' )
{
do_say( banker, "If you need help, see HELP BANK." );
return;
}
argument = one_argument( argument, arg1 );
if ( arg1 == '\0' )
{
sprintf( buf, "%s How much gold do you wish to withdraw?", ch->name );
do_tell( banker, buf );
return;
}
if ( str_cmp( arg1, "all" ) && !is_number( arg1 ) )
{
sprintf( buf, "%s How much gold do you wish to withdraw?", ch->name );
do_tell( banker, buf );
return;
}
if ( !str_cmp( arg1, "all" ) )
amount = ch->pcdata->balance;
else
amount = atoi( arg1 );
if( amount > ch->pcdata->balance )
{
sprintf( buf, "%s But you do not have that much gold in your account!", ch->name );
do_tell( banker, buf );
return;
}
if ( amount <= 0 )
{
sprintf( buf, "%s Oh I see.. your a comedian.", ch->name );
do_tell( banker, buf );
return;
}
ch->pcdata->balance -= amount;
ch->gold += amount;
set_char_color( AT_PLAIN, ch );
ch_printf( ch, "You withdraw %d gold.\n\r", amount );
sprintf( buf, "$n withdraws %d gold.\n\r", amount );
act( AT_PLAIN, buf, ch, NULL, NULL, TO_ROOM );
save_char_obj( ch );
return;
}
i'm guessin it's in the arg1 or something.
|