When ever I slay a NPC, 
[*****] BUG: Obj_from_char: null ch.
is printed to a log file until the game crashes. I don't know whats causing 
it, or how to fix it. 
I can kill a NPC normally (via weapons/spells) and it doesn't crash. I can 
slay a PC and it doesn't crash.
Here is what GDB gave me:
#0  0x400a4744 in __write ()
#1  0x400d26cc in __DTOR_END__ ()
#2  0x40076454 in _IO_do_write (fp=0x80dbd78,
    data=0xbfff7504 "Mon Apr 22 15:34:21 2002 :: [*****] BUG: Obj_from_char: 
null ch.\n",
    to_do=65) at fileops.c:255
#3  0x40076c88 in _IO_file_xsputn (f=0x80dbd78, data=0xbfff7504, n=65) at 
fileops.c:692
#4  0x4006daf8 in buffered_vfprintf (s=0x80dbd78, format=0x80c50ec "%s :: 
%s\n", args=0xbfff9b50)
    at vfprintf.c:1561
#5  0x400694f3 in _IO_vfprintf (s=0x80dbd78, format=0x80c50ec "%s :: %s\n", 
ap=0xbfff9b50)
    at vfprintf.c:886
#6  0x40070291 in fprintf (stream=0x80dbd78, format=0x80c50ec "%s :: %s\n") 
at fprintf.c:34
#7  0x8076676 in log_string (str=0xbfff9b84 "[*****] BUG: Obj_from_char: null 
ch.") at db.c:3783
#8  0x807662f in bug (str=0x80c7a29 "Obj_from_char: null ch.", param=0) at 
db.c:3758
#9  0x8082233 in obj_from_char (obj=0x402a6770) at handler.c:1447
#10 0x807ba41 in make_corpse (ch=0x402a6608) at fight.c:2205
#11 0x807bddb in raw_kill (victim=0x402a6608) at fight.c:2384
#12 0x807e2e7 in do_slay (ch=0x402c14a0, argument=0x402c023e "dra") at 
fight.c:3749
#13 0x8086095 in interpret (ch=0x402c14a0, argument=0x402c0239 "slay dra") at 
interp.c:591
#14 0x8069170 in substitute_alias (d=0x402bfe1c, argument=0x402c0239 "slay 
dra") at alias.c:95
#15 0x806a248 in game_loop_unix (control=6) at comm.c:820
#16 0x8069d70 in main (argc=2, argv=0xbffffd50) at comm.c:443


here is raw_kill:
void raw_kill( CHAR_DATA *victim )
{
    int i;

    stop_fighting( victim, TRUE );
    death_cry( victim );
    make_corpse( victim );

    if ( IS_NPC(victim) )
    {
        victim->pIndexData->killed++;
        kill_table[URANGE(0, victim->level, MAX_LEVEL-1)].killed++;
        extract_char( victim, TRUE );
        return;
    }
  extract_char( victim, FALSE );
    while ( victim->affected )
        affect_remove( victim, victim->affected );
    victim->affected_by = race_table[victim->race].aff;
    for (i = 0; i < 4; i++)
        victim->armor[i]= 100;
    victim->position    = POS_RESTING;
    victim->hit         = UMAX( 1, victim->hit  );
    victim->mana        = UMAX( 1, victim->mana );
    victim->move        = UMAX( 1, victim->move );

if (!IS_NPC(victim))
{
    gain_condition( victim, COND_BLEEDING, -100 );
}
/*  save_char_obj( victim ); we're stable enough to not need this :) */
    return;
}

do_slay:
void do_slay( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char arg[MAX_INPUT_LENGTH];

    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
        send_to_char( "Slay whom?\n\r", ch );
        return;
    }

    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
        send_to_char( "They aren't here.\n\r", ch );
       return;
    }

    if ( ch == victim )
    {
        send_to_char( "Suicide is a mortal sin.\n\r", ch );
        return;
    }

    if ( !IS_NPC(victim) && victim->level >= get_trust(ch) )
    {
        send_to_char( "You failed.\n\r", ch );
        return;
    }
   act( "{1You slay $M in cold blood!{x",  ch, NULL, victim, TO_CHAR    );
    act( "{1$n slays you in cold blood!{x", ch, NULL, victim, TO_VICT    );
    act( "{1$n slays $N in cold blood!{x",  ch, NULL, victim, TO_NOTVICT );
    raw_kill( victim );
    return;
}

I can post some more code. I asked a few people and they don't know what it 
is. Any help is wanted. Thank you

Reply via email to