Re: 128 Bit Vector Crashola Bug

From: Erik & Tanya Niese-Petersen (Tenp@CRIS.COM)
Date: 12/15/97


On Mon, 15 Dec 1997, Chuck Carson wrote:

<-- SNIP -->

> Here are the code segments around this line:
>     /* Aggressive Mobs */
> ==PATCH======>    if (MOB_FLAGGED(ch, MOB_AGGRESSIVE) || = MOB_FLAGGED(ch,
> MOB_AGGR_TO_ALIGN)) {
>       found == FALSE;
> ===CRASHOLA==>      for (vict =3D world[ch->in_room].people; =
> vict && !found; vict == vict->next_in_room) {

And here we got a good old crash bug (Wonder if bpl12 got all of them
cleaned out ? :), else I would suggest that next patch has. )

Each time you have a for(bleh=ppl; bleh; bleh = bleh->next) you have
a high possiblity for crash specially when 'bleh' (in your case 'vict')
got a good chance for being removed from memory (death, etc). So if
'bleh' gets removed then where is 'bleh->next' pointing at ? most of the
time the empty space.. AKA crash bug.
How to fix it. Make another variable called 'bleh_next' or 'vict_next' or
whatever. And change the last part of the for() to 'vict = vict_next' and
first in the for() { } part insert 'vict_next = vict->next_in_room'..
To see it better:

   struct char_data *vict_next;

   for (vict = world[ch->in_room].people; vict && !found;
         vict = vict_next) {
     vict_next = vict->next_in_room;

   etc..

   }


This should fix your problem..

If not.. Please write me again..

Erik Niese-Petersen
AKA Quint the Typo Dane


     +------------------------------------------------------------+
     | 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/08/00 PST