for (wear_loc = WEAR_LIGHT; wear_loc < MAX_WEAR -1 ; wear_loc++)
    {
        if ((obj = get_eq_char(ch, wear_loc)) != NULL)
        {
            for (paf = obj->pIndexData->affected; paf != NULL; paf =
paf->next)
            {
                if (paf->bitvector) switch (paf->where)
                {
                    case TO_AFFECTS: SET_BIT(aff,paf->bitvector );
break;
                    case TO_IMMUNE:  SET_BIT(imm,paf->bitvector );
break;
                    case TO_RESIST:  SET_BIT(res,paf->bitvector );
break;
                    case TO_VULN:    SET_BIT(vuln,paf->bitvector);
break;
                    default:     break;
                }
            }
            for (paf = obj->affected; paf != NULL; paf = paf->next)
            {
                if (paf->bitvector) switch (paf->where)
                {
                    case TO_AFFECTS: SET_BIT(aff,paf->bitvector );
break;
                    case TO_IMMUNE:  SET_BIT(imm,paf->bitvector );
break;
                    case TO_RESIST:  SET_BIT(res,paf->bitvector );
break;
                    case TO_VULN:    SET_BIT(vuln,paf->bitvector);
break;
                    default:     break;
                }
            }
        }
    }

    SET_BIT(imm, ch->imm_flags );
    SET_BIT(res, ch->res_flags );
    SET_BIT(vuln,ch->vuln_flags);

    if (imm != 0 || res != 0 || vuln != 0) aFound = TRUE;

    if (aff>0) chprintlnf(ch,"{GEquipment affects:{x\n\r%s",flag_string
(affect_flags, paf->bitvector));
    if (imm>0) chprintlnf(ch,"{GImmunities:{x\n\r%s",flag_string
(imm_flags, paf->bitvector));
    if (res>0) chprintlnf(ch,"{GResistants:{x\n\r%s",flag_string
(res_flags, paf->bitvector));
    if (vuln>0) chprintlnf(ch,"{GVulnerables:{x\n\r%s",flag_string
(vuln_flags, paf->bitvector));


Pretty sure the "paf" in the flag_string calls above is the problem.  In
general, since I assume most the time you are wearing eq, the problem is
due specifically because of the second for loop when cycling through
wear_loc's.  The loop continues until paf == NULL (the condition is paf
!= NULL to continue, so it not going to continue the loop once paf ==
NULL).  Then, below that, you are using paf in the call to flag_string,
but paf at this point is going to be NULL, therefore the crash.

My guess, since you are storing the affects, resist's, vuln's, and
immune's, you would want to change paf->bitvector in the calls to
flag_string to aff, imm, res, or vuln.

Hope that helped.


Reply via email to