Pages:<< prev 1 next >>
Off the Edge of the Map

GroupAdministrators
Posts1,199
JoinedMar 21, 2006
Bug: Misspelled arguments for bank command.
Danger: Trivial - Annoyance. Misspelled words are annoying. Especially when they impede the use of a command.
Found by: Caius
Fixed by: Kayle
---
misc.c, do_bank
Replace the whole thing with:
Easier than trying to make a code block for each of the changes.
Danger: Trivial - Annoyance. Misspelled words are annoying. Especially when they impede the use of a command.
Found by: Caius
Fixed by: Kayle
---
misc.c, do_bank
Replace the whole thing with:
void do_bank( CHAR_DATA * ch, const char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
long amount = 0;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if( IS_NPC( ch ) || !ch->pcdata )
return;
if( !ch->in_room || !IS_SET( ch->in_room->room_flags, ROOM_BANK ) )
{
send_to_char( "You must be in a bank to do that!\r\n", ch );
return;
}
if( arg1[0] == '\0' )
{
send_to_char( "Usage: BANK <deposit|withdraw|balance> [amount]\r\n", ch );
return;
}
if( arg2[0] != '\0' )
amount = atoi( arg2 );
if( !str_prefix( arg1, "deposit" ) )
{
if( amount <= 0 )
{
send_to_char( "You may only deposit amounts greater than zero.\r\n", ch );
do_bank( ch, "" );
return;
}
if( ch->gold < amount )
{
send_to_char( "You don't have that many credits on you.\r\n", ch );
return;
}
ch->gold -= amount;
ch->pcdata->bank += amount;
ch_printf( ch, "You deposit %ld credits into your account.\r\n", amount );
return;
}
else if( !str_prefix( arg1, "withdraw" ) )
{
if( amount <= 0 )
{
send_to_char( "You may only withdraw amounts greater than zero.\r\n", ch );
do_bank( ch, "" );
return;
}
if( ch->pcdata->bank < amount )
{
send_to_char( "You don't have that many credits in your account.\r\n", ch );
return;
}
ch->gold += amount;
ch->pcdata->bank -= amount;
ch_printf( ch, "You withdraw %ld credits from your account.\r\n", amount );
return;
}
else if( !str_prefix( arg1, "balance" ) )
{
ch_printf( ch, "You have %ld credits in your account.\r\n", ch->pcdata->bank );
return;
}
else
{
do_bank( ch, "" );
return;
}
}
Easier than trying to make a code block for each of the changes.
Pages:<< prev 1 next >>