Premium ahynoa 15 Posted August 2, 2016 Premium Share Posted August 2, 2016 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 More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now