Re: Crash with set_fighting

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


On Sat, 31 Jan 1998, John Evans wrote:

> I am having a most interesting time with set_fighting. For some reason, it
> likes to crash my MUD without (from what I can tell) rhyme or reason.

[gdb and code snipped]

> I checked my set_fighting vs. stock set_fighting code and they are
> identical exept for the fact that I renamed the IS_AFFECTED macro to
> AFF_FLAGGED to be more consitent with the rest of the macros.

I found the following line at the top of set_fighting():

  assert(!FIGHTING(ch));

If you do:
set_fighting(ch, vict);
and ch is already fighting someone that assert() call forced the MUD to
shutdown.

This seemed like a problem to me, so I removed that line and replaced it
with:

  if (FIGHTING(ch))
    return;

That way nothing harmful happens by interrupting an ongoing fight and the
MUD doesn't get shutdown.

Anyone see anything wrong with this fix?

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