Re: Crash

From: Claude Belisle (cbeli@pop.agri.ch)
Date: 02/20/00


Jerry Billings wrote:

> Okay this is about the tenth time i've had a crash with the same code. i've
> added amny different bits of code and every now and then one will crash, but
> not because of the code i added. when i debug it it sends me to this code.
>
> void hitprcnt_mtrigger(char_data *ch)
> {
>   trig_data *t;
>   char buf[MAX_INPUT_LENGTH];
>
>   if (!SCRIPT_CHECK(ch, MTRIG_HITPRCNT) || !FIGHTING(ch) || /* CODE THAT
> CRASHES */ AFF_FLAGGED(ch, AFF_CHARM))
>     return;
>
>   for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
>     if (TRIGGER_CHECK(t, MTRIG_HITPRCNT) && GET_MAX_HIT(ch) &&
>     (((GET_HIT(ch) * 100) / GET_MAX_HIT(ch)) <= GET_TRIG_NARG(t))) {
>
>       ADD_UID_VAR(buf, t, FIGHTING(ch), "actor", 0)
>       script_driver(ch, t, MOB_TRIGGER, TRIG_NEW);
>       break;
>     }
>   }
> }
>

Looks like another hole ridden procedure :(  If the mob dies and has a
hitpercent
trigger on,  depending on your luck that day, the MUD will crash.  Similar
things
happen when a random of fight trigger fires on a mob that just dies.  I noticed
that
when a mob dies, it's name his set to NULL. So that is what I check before
executing any piece of code like that (script_trigger_check(),
fight_mtrigger(),
hitprcnt_mtrigger(), etc)

Claude


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



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