Jump to content

help with this function


Recommended Posts

  • Premium
Spoiler

struct CPetSystem::OPetAttribute
{
    BYTE    mAttrId;
    int        mAmount;
    bool    mIsApply;
    
    OPetAttribute(const BYTE cAttrId, const int cAmount, const bool cIsApply) : mAttrId(cAttrId), mAmount(cAmount), mIsApply(cIsApply)
    { }
    
    bool operator== (const OPetAttribute& rcPetAttribute)
    {
        return (mAttrId == rcPetAttribute.mAttrId && mAmount == rcPetAttribute.mAmount && mIsApply == rcPetAttribute.mIsApply);
    }
};

 

Spoiler

void CPetSystem::RemoveAttribute(const BYTE cApplyId, const int cAmount)
{
    if (cApplyId > APPLY_NONE && cApplyId < MAX_APPLY_NUM)
    {
        std::auto_ptr<OPetAttribute> pet_attr(M2_NEW OPetAttribute(cApplyId, cAmount, true));
        OPetAttrContainer::iterator attr_pos = std::find(mPetAttributes.begin(), mPetAttributes.end(), pet_attr.get());
        if (attr_pos != mPetAttributes.end())
        {
            m_pkOwner->ApplyPoint(cApplyId, -1*cAmount);
            mPetAttributes.erase(attr_pos);
        }
    }
}

it is assumed that this function must remove an item from the list but I can not get into if (attr_pos != mPetAttributes.end()) and do not delete anything

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.