void advance_level( CHAR_DATA * ch )
{
char buf[MAX_STRING_LENGTH];
int add_hp;
int add_mana;
int add_move;
int add_prac;
snprintf( buf, MAX_STRING_LENGTH, "%s" ,title_table[ch->Class][ch->level][ch->sex == SEX_FEMALE ? 1 : 0] );
if ( (buf[0] != '\0') && (str_cmp( buf, "(null)" ) != 0) )
set_title(ch, buf );
add_hp = con_app[get_curr_con( ch )].hitp + number_range( class_table[ch->Class]->hp_min,
class_table[ch->Class]->hp_max );
add_mana = class_table[ch->Class]->fMana ? number_range( 2, ( 2 * get_curr_int( ch ) + get_curr_wis( ch ) ) / 8 ) : 0;
add_move = number_range( 5, ( get_curr_con( ch ) + get_curr_dex( ch ) ) / 4 );
add_prac = wis_app[get_curr_wis( ch )].practice;
add_hp = UMAX( 1, add_hp );
add_mana = UMAX( 0, add_mana );
add_move = UMAX( 10, add_move );
/*
* bonus for deadlies
*/
if( IS_PKILL( ch ) )
{
add_mana = ( int )( add_mana + add_mana * .3 );
add_move = ( int )( add_move + add_move * .3 );
add_hp += 1; /* bitch at blod if you don't like this :) */
send_to_char( "Gravoc's Pandect steels your sinews.\n\r", ch );
}
ch->max_hit += add_hp;
ch->max_mana += add_mana;
ch->max_move += add_move;
ch->practice += add_prac;
if( !IS_NPC( ch ) )
xREMOVE_BIT( ch->act, PLR_BOUGHT_PET );
if( ch->level == LEVEL_AVATAR )
{
DESCRIPTOR_DATA *d;
for( d = first_descriptor; d; d = d->next )
if( d->connected == CON_PLAYING && d->character != ch )
{
set_char_color( AT_IMMORT, d->character );
ch_printf( d->character, "%s has just achieved Avatarhood!\n\r", ch->name );
}
set_char_color( AT_WHITE, ch );
do_help( ch, "M_ADVHERO_" );
}
if( ch->level < LEVEL_IMMORTAL )
{
if( IS_VAMPIRE( ch ) )
snprintf( buf, MAX_STRING_LENGTH,
"Your gain is: %d/%d hp, %d/%d bp, %d/%d mv %d/%d prac.\n\r",
add_hp, ch->max_hit, 1, ch->level + 10, add_move, ch->max_move, add_prac, ch->practice );
else
snprintf( buf, MAX_STRING_LENGTH,
"Your gain is: %d/%d hp, %d/%d mana, %d/%d mv %d/%d prac.\n\r",
add_hp, ch->max_hit, add_mana, ch->max_mana, add_move, ch->max_move, add_prac, ch->practice );
set_char_color( AT_WHITE, ch );
send_to_char( buf, ch );
}
return;
}
I am not sure whether it is a null pointer or not. I would assume it is not, becuase i dont think the compiler/enviorment would allow the print of a null pointer. It could be that in the code null pointer is converted to the string "(null)", but if that is the case, then my the above function should work. I'm not really sure. |