Re: [NEWBIE] Crashing circle30bpl16-dg7a-oasis2.0

From: Patrick Dughi (
Date: 03/22/00

> del wrote:
> This topic has been up before, if you check the archives.. I believe the
> solution was to check to make sure there was a victim in fight code.
> steve wrote:
> I've been dabbling with the circle30bpl16-dg7a-oasis2.0 archive from the
> ftp site and I have come up with the following crash...
> Whenever a mortal character "kills" another mob, the mud crashes.
> I have narrowed down the error (as best I think I know how to) to fight.c
> in the raw_kill or die methods.
> void die(struct char_data * ch, struct char_data * killer)
> {
>   gain_exp(ch, -(GET_EXP(ch) / 2));
>   if (!IS_NPC(ch)) {
>   }
>   raw_kill(ch, killer);  <-------
> }

        I read along in the archives, and apparently, this happens - yes -
due to one of these (usually the ch - person being killed) being
..well..killed, extracted, etc.  The fix was to check above to only run
the hitprcnt_mtrigger() code if damage does not return a -1 (-1 indicates
death).  Since you indicated that it was the death_mtrigger(), I suspect
this is a slightly different issue.

        The problem here is that you cannot necessarily check for the
validity of "ch".  If the character has been extracted, and that memory
freed, you have no guarentee that "ch" will be NULL, or has already been
reallocated, etc.  I have seen this problem a while ago with mobprogs
where the death code included loading up a new mob, and purging themselves
(to make it look like a death-transformation thing).  If you'd like to
know a good way to get around this sort of design limitation, check out my
moblists patch (and associated readme) at

        I can't say this is the solution for sure, but it does allow a
sort of deferred status for characters to be extracted.  What I'm most
surprised about is that you imply this happens with every mob, when the
same situation happened to me before, only with specific mobs and was
state specific, so it didn't always go boom.

        So, i'd also take a long hard look at your version of
death_mtrigger - make sure that you don't do any extraction of characters
in there, or otherwise mangling your pointer.

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/10/01 PDT