Caught in loop, char_died?

Posted by Zeno on Tue 24 May 2005 10:27 PM — 4 posts, 10,518 views.

USA #0
Got home found the MUD was caught in a loop:
0x080de2e3 in char_died (ch=0xc857cc0) at handler.c:3882
3882            if ( ccd->ch == ch )
(gdb) bt
#0  0x080de2e3 in char_died (ch=0xc857cc0) at handler.c:3882
#1  0x080d426e in free_fight (ch=0x933e8c0) at fight.c:3216
#2  0x080d43c3 in stop_fighting (ch=0xc857cc0, fBoth=1 '\001') at fight.c:3254
#3  0x080d47bc in raw_kill (ch=0x933e8c0, victim=0xc857cc0) at fight.c:3463
#4  0x080d32c1 in damage (ch=0x933e8c0, victim=Variable "victim" is not available.
) at fight.c:2561
#5  0x08139dcb in do_jakai_flare (ch=0x933e8c0, argument=0xbfe5fbb9 "") at skills.c:7024
#6  0x08129146 in check_skill (ch=0x933e8c0, command=0xbfe5f76c "jakai", argument=0xbfe5fbb9 "") at skills.c:456
#7  0x080e22f1 in interpret (ch=0x933e8c0, argument=0xbfe5fbb9 "") at interp.c:492
#8  0x080b67ab in game_loop () at comm.c:972
#9  0x080b5b4c in main (argc=2, argv=0xbfe61114) at comm.c:340


Notice frame 4? I have never see that "variable is not available" before... Any ideas?

This is the jakai_flare loop:
    for ( vch = first_char; vch; vch = vch_next )
    {
        vch_next        = vch->next;
        if ( !vch->in_room || ch == vch )
            continue;
        if ( vch->in_room == ch->in_room )
        {
            if ( is_safe( ch, vch, FALSE ) )
              continue;

            global_retcode = damage( ch, vch, number_range(80+get_curr_int(ch)+get_curr_wis(ch),
180+get_curr_int(ch)+get_curr_wis(ch)), gsn_jakai_flare );

        }

Did I do something wrong there?
USA #1
Is this loop of yours intended to affect only the room the PC is in, or any character anywhere on the mud?
USA #2
Any character in the room. Thus the room checks.
USA #3
In that case:


    for ( vch = first_char; vch; vch = vch_next )
    {
        vch_next        = vch->next;


vc_next should be getting set to vch->next_in_room instead of simply vch->next. Your loop is currently checking everyone in the world.

I don't know that this will solve your problem with it being available or not, but it will at least be doing what you asked of it.