Re: [CODE][NEWBIE]Crashing during combat

From: John Evans (evansj@HI-LINE.NET)
Date: 02/06/98


On Fri, 6 Feb 1998, Bill Merrill wrote:

> Hello,
>
> My first time posting so hopefully I do this correctly. I am pretty new to
> coding but I am picking it up slowly. I added the dual-wield skill and a
> second attack skill to my code(after alot of necessary modification). Now
> when testing it, the mud randomly crashes during the middle of combat. Here
> is what gdb outputs:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x8069fee in hit (ch=0x82a0918, victim=0x0, type=-1) at fight.c:801
> 801       victim_ac = GET_AC(victim) / 10;
>

What is most liely happening is that the victim is killed and then gets
hit again. Since you are trying to calc the AC of an extracted character,
you run into problems.  Like so:

Joe hits Bob.
Joe hits Bob and kills him. (make_corpse(), die(), extract_char(), etc)
Joe hits Bob... CRASH.

Bob is dead and gone, so you can't hit him. Computers don't like fiddling
with things that don't exist, so they give up on you and crash. :)


I don't know what your code looks like since I coded my own florentine,
double-attack and haste code. Now that you know the problem, you can
probably find a solution.


John Evans <evansj@hi-line.net>  --  http://www.hi-line.net/~evansj/

Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST