First, Its been 5 years, and I still find some stock ROM bugs.  This one
eluded every mud coder I spoke to.. anyways.. here it is.

this is also on my buglisting.txt file on
www.mageslair.net/snippets/snippets.html page

Pets with SANC and HASTE (and some other spells) will duplicate affects.
This is
due to fread_pet loading the original pet and the original affects, then
loading
the affects on top of that.  The fix has to do with save.c

in fread_pet.. move the int vnum to a global to the function instead of
local
to the Vnum read.
Next in the Affc section.
      if (!check_pet_affected(vnum,paf))
      {
        paf->next       = pet->affected;
        pet->affected   = paf;
       } else{
        free_affect(paf);
       }

in place of the paf->next and pet->affected lines.  This will enable the
check function
to determine if they should PUT the affect on the pet.

In db.c (where I put it)  put the check function:

/* remove duplicate affects on pets */
bool check_pet_affected(int vnum, AFFECT_DATA *paf)
{
  MOB_INDEX_DATA *petIndex;

  petIndex = get_mob_index(vnum);
  if (petIndex == NULL)
    return FALSE;

  if (paf->where == TO_AFFECTS)
    if (IS_AFFECTED(petIndex, paf->bitvector))
      return TRUE;

  return FALSE;
}


put the function prototype in merc.h and you are done!!!



Reply via email to