for( vch = mob->in_room->first_person; vch != NULL; vch = vch->next_in_room )
for( vch = mob->in_room->first_person; vch != NULL; vch = vch_next )
{
vch_next = vch->next_in_room;
(gdb) frame 4
#4 0x000000000054f52c in mprog_driver (com_list=0xb18980 "mpmload 329\n\rmpforce mobslave mpoload 10212\n\rmpforce mobslave drop all\n\rmptransfer mobslave 7\n\r",
mob=0x14e16b0, actor=0x18a77c0, obj=0x0, vo=0x0, single_step=0 '\0') at mud_prog.c:1516
1516 for( vch = mob->in_room->first_person; vch; vch = vch->next_in_room )
(gdb) print mob->in_room
$1 = (ROOM_INDEX_DATA *) 0x0
(gdb) print mob->in_room->first_person
Cannot access memory at address 0x10
(gdb) q
void raw_kill( CHAR_DATA * ch, CHAR_DATA * victim )
{
CHAR_DATA *victmp;
CHAR_DATA *vendor;
HISCORE *table;
CHAR_DATA *owner;
CLAN_DATA *clan;
FELLOW_DATA *fellow;
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
char arg[MAX_STRING_LENGTH];
char cmd[MSL];
OBJ_DATA *obj, *obj_next;
SHIP_DATA *ship;
if( !victim )
{
bug( "raw_kill: null victim!", 0 );
return;
}
strcpy( arg, victim->name );
stop_fighting( victim, TRUE );
if( ch && !IS_NPC( ch ) && !IS_NPC( victim ) )
claim_disintigration( ch, victim );
/* Take care of polymorphed chars */
if( IS_NPC( victim ) && IS_SET( victim->act, ACT_POLYMORPHED ) )
if( IS_NPC( victim ) && IS_SET( victim->act, ACT_POLYMORPHED ) )
{
char_from_room( victim->desc->original );
char_to_room( victim->desc->original, victim->in_room );
victmp = victim->desc->original;
do_revert( victim, "" );
raw_kill( ch, victmp );
return;
}
if( !IS_NPC(victim) && IS_SET( victim->act, PLR_AFK) && !IS_SET( victim->pcdata->flags, PCFLAG_TWIT))
{
sprintf( buf, "%s being passed through raw_kill .. %s is AFK!!", victim->name, victim->name );
log_string_plus( buf, LOG_NORMAL, sysdata.log_level );
}
if( victim->in_room && IS_NPC( victim ) && victim->vip_flags != 0 && victim->in_room->area
&& victim->in_room->area->planet )
{
victim->in_room->area->planet->population–;
victim->in_room->area->planet->population = UMAX( victim->in_room->area->planet->population, 0 );
victim->in_room->area->planet->pop_support -= ( float )( 1 + 1 / ( victim->in_room->area->planet->population + 1 ) );
if( victim->in_room->area->planet->pop_support < -100 )
victim->in_room->area->planet->pop_support = -100;
}
if( IS_NPC( victim ) && !IS_SET( victim->act, ACT_NOKILL ) )
{
mprog_death_trigger( ch, victim );
if( char_died( victim ) )
return;
}
if( IS_NPC( victim ) && !IS_SET( victim->act, ACT_NOKILL ) )
{
rprog_death_trigger( ch, victim );
if( char_died( victim ) )
return;
}
for( vch = mob->in_room->first_person; vch != NULL; vch = vch->next_in_room )
for( vch = mob->in_room->first_person; vch != NULL; vch = vch_next )
{
vch_next = vch->next_in_room;
mprog_death_trigger( )
{
mob->position = POS_STANDING;
mprog_percent_check (mob, bli, bla, blo, DEATH_PROG);
mob->position = POS_DEAD;
}
for( vch = mob->in_room->first_person; vch != NULL; vch = vch->next_in_room )
void mprog_death_trigger( CHAR_DATA * killer, CHAR_DATA * mob )
{
if( IS_NPC( mob ) && killer != mob && ( mob->pIndexData->progtypes & DEATH_PROG ) )
{
mprog_percent_check( mob, killer, NULL, NULL, DEATH_PROG );
}
death_cry(mob);
return;
}
void mprog_percent_check( CHAR_DATA * mob, CHAR_DATA * actor, OBJ_DATA * obj, void *vo, int type )
{
MPROG_DATA *mprg;
for( mprg = mob->pIndexData->mudprogs; mprg; mprg = mprg->next )
if( ( mprg->type & type ) && ( number_percent( ) <= atoi( mprg->arglist ) ) )
{
mprog_driver( mprg->comlist, mob, actor, obj, vo, FALSE );
if( type != GREET_PROG && type != ALL_GREET_PROG )
break;
}
return;
}
(gdb) frame 8
#8 0x00000000004ecf6e in damage (ch=0x18a77c0, victim=0x14e16b0, dam=1592, dt=1003) at fight.c:1847
1847 raw_kill( ch, victim );
(gdb) print mob->in-room
No symbol "mob" in current context.
(gdb) print victim->in_room
$1 = (ROOM_INDEX_DATA *) 0x0
(gdb) frame 9
#9 0x00000000004eabfb in one_hit (ch=0x18a77c0, victim=0x14e16b0, dt=1003) at fight.c:1196
1196 if( ( retcode = damage( ch, victim, dam, dt ) ) != rNONE )
(gdb) print victim->in_room
$2 = (ROOM_INDEX_DATA *) 0x0
(gdb) frame 10
#10 0x00000000004b58b8 in do_hitall (ch=0x18a77c0, argument=0x7fff1d7fca16 "") at combat.c:719
719 global_retcode = one_hit( ch, vch, TYPE_UNDEFINED );
(gdb) print vch->in_room
$3 = (ROOM_INDEX_DATA *) 0x0
(gdb) print ch->in_room
$4 = (ROOM_INDEX_DATA *) 0xb22f80
(gdb) print ch->in_room->first_person->name
$5 = 0x977dd0 "Tarki"
(gdb) print vh->in_room->first_person->name
No symbol "vh" in current context.
(gdb) print vch->in_room->first_person->name
Cannot access memory at address 0x10
(gdb) frame 11
#11 0x000000000057d17e in check_skill (ch=0x18a77c0, command=0x7fff1d7fc4e0 "hitall", argument=0x7fff1d7fca16 "") at skills.c:395
395 ( *skill_table[sn]->skill_fun ) ( ch, argument );
(gdb)
#0 0x0000003b492305c5 in raise () from /lib64/libc.so.6
#1 0x0000003b49232070 in abort () from /lib64/libc.so.6
#2 0x00000000004bcbd0 in SegVio () at comm.c:431
#3 <signal handler called>
#4 0x000000000054f52c in mprog_driver (com_list=0xb18980 "mpmload 329\n\rmpforce mobslave mpoload 10212\n\rmpforce mobslave drop all\n\rmptransfer mobslave 7\n\r",
mob=0x14e16b0, actor=0x18a77c0, obj=0x0, vo=0x0, single_step=0 '\0') at mud_prog.c:1516
#5 0x00000000005511f3 in mprog_percent_check (mob=0x14e16b0, actor=0x18a77c0, obj=0x0, vo=0x0, type=16) at mud_prog.c:2250
#6 0x00000000005517fb in mprog_death_trigger (killer=0x18a77c0, mob=0x14e16b0) at mud_prog.c:2423
#7 0x00000000004edff9 in raw_kill (ch=0x18a77c0, victim=0x14e16b0) at fight.c:2298
#8 0x00000000004ecf6e in damage (ch=0x18a77c0, victim=0x14e16b0, dam=1592, dt=1003) at fight.c:1847
#9 0x00000000004eabfb in one_hit (ch=0x18a77c0, victim=0x14e16b0, dt=1003) at fight.c:1196
#10 0x00000000004b58b8 in do_hitall (ch=0x18a77c0, argument=0x7fff1d7fca16 "") at combat.c:719
#11 0x000000000057d17e in check_skill (ch=0x18a77c0, command=0x7fff1d7fc4e0 "hitall", argument=0x7fff1d7fca16 "") at skills.c:395
#12 0x0000000000519886 in interpret (ch=0x18a77c0, argument=0x7fff1d7fca16 "") at interp.c:376
#13 0x00000000004bdd1d in game_loop () at comm.c:788
#14 0x00000000004bc92e in main (argc=2, argv=0x7fff1d7fcf48) at comm.c:302
/* External from fight.c */
ch_ret one_hit args( ( CHAR_DATA * ch, CHAR_DATA * victim, int dt ) );
void do_hitall( CHAR_DATA * ch, char *argument )
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
sh_int nvict = 0;
sh_int nhit = 0;
sh_int percent;
if( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) )
{
send_to_char( "You cannot do that here.\n\r", ch );
return;
}
if( !ch->in_room->first_person )
{
send_to_char( "There's no one here!\n\r", ch );
return;
}
percent = IS_NPC( ch ) ? 80 : ch->pcdata->learned[gsn_hitall];
for( vch = ch->in_room->first_person; vch; vch = vch_next )
{
vch_next = vch->next_in_room;
if( is_same_group( ch, vch ) || !is_legal_kill( ch, vch ) || !can_see( ch, vch ) || is_safe( ch, vch )
|| !IS_NPC( vch ) )
continue;
if( ++nvict > ch->skill_level[COMBAT_ABILITY] / 5 )
break;
if( chance( ch, percent ) )
{
nhit++;
global_retcode = one_hit( ch, vch, TYPE_UNDEFINED );
}
else
global_retcode = damage( ch, vch, 0, TYPE_UNDEFINED );
/*
* Fireshield, etc. could kill ch too.. :>.. – Altrag
*/
if( global_retcode == rCHAR_DIED || global_retcode == rBOTH_DIED || char_died( ch ) )
return;
}
if( !nvict )
{
send_to_char( "There's no one here!\n\r", ch );
return;
}
ch->move = UMAX( 0, ch->move - nvict * 3 + nhit );
if( nhit )
learn_from_success( ch, gsn_hitall );
else
learn_from_failure( ch, gsn_hitall );
return;
}
Frame 4:
mud_prog.c, 1516:
It appears to be crashing because vch is null, and my suggested fix would be to put "vch &&" in the ifcheck, but it's crashing on the for statement and not the ifcheck. What should I do?