Re: Seg. fault, multi-attack

From: Ryan Kolak (
Date: 09/20/95

I had a similar problem with in fight.c and also in some of my spec_procs

The problem is simple... the server doesn't handle attacking a dead 
player very well... This was causing a crash on my system. When I put a 
check to make sure that the player hasn't died yet... it works like a charm.

That is why whenever you see some code that does damage it checks to make 
sure that the victim is still fighting and is still alive... just a handy 
dandy little thing that keeps a mud up and running.


Ryan Kolak            | "I do not fear computers, I fear the lack of them"
University of Illinois|                                       -Isaac Asimov        | "A Life without cause is a life without effect."
                      |   -Dildono from "Barbarella: Queen of the Universe"
<a HREF = "">My Web Server</a> -- Check it Out

On Wed, 20 Sep 1995, Rasmus Rxnlev wrote:

> Hi again,
> After trying some different things, for one useing gdb to trace where my 
> circle code crashes I'm eft in an empty space... 8)
> It seems as if my fight.c code is the 'nasty bugged' code.
> I implemented multiple attacks, and to make thge situation clearer I've 
> decided to post my (very short) way of implementing it ... (wich I by the 
> way beleave is the thing that causes the bug).
> in the perform_violence() routine I've added the following:
> [The original code - CUT:]
> if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL)
>    (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "");
> [UNCUT], this is what I've added... 
>     hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
>     hit(ch, FIGHTING(ch), TYPE_UNDEFINED); 
> Now, when I run this on my own Linux mashine (with and without gdb) the 
> mud seems to run perfectly... 
> Now when i transter the source (and only the soure, not pfiles! 8) I 
> allso compile the source without errors on teh SunOS.. 
> Now, if I start a fight on the SunOS mashine I get some combat messages, 
> and then the mud crashes... 
> when using gdb it said it crashed in line 765 of the fight.c code... 
> this is in the hit() procedure... 
> [CUT]
>  (line 765:)    if (ch->in_room != victim->in_room) {
>                   if (FIGHTING(ch) && FIGHTING(ch) == victim)
>                      stop_fighting(ch);
>                      return;
> This is as far as I could trace the bug... it seems as if the problem 
> arises when the ch->in_room  ot victim->in_room is evaluated... but on 
> the other hand, if this is the case it should crash on both mashines... 
> I'd be happy to send more info, or whatever... 
> Might allso be, that I need some new glasses because i've missed the 
> obvious reason...
> Anyways, hope I didnt mess up your lives, or burned down a mailserver to 
> get anought bandwith to get this message thru to you 8)
> Regards,
> Rasmus R./Con.

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