void deleteMonster(monster_t* const monster){ if( monster->object ) deleteObject(monster->object); if( monster->inventory ) deleteInventory(monster->inventory); if( monster->combat ) deleteCombat(monster->combat); if( monster->equipment ) deleteEquipmentSlots(monster->equipment); if( monster->skills ) deleteSkillSlots(monster->skills); if( monster->buff ) deleteBuff(monster->buff); free(monster); }
//----------------------------------------------------------------------- void SBuffManager::deleteBuffByAbsorbType( STATUS_ABSORBTYPE type ) { std::map<UInt, BuffObject*>::iterator front = mMapBuffObject.begin(); std::map<UInt, BuffObject*>::iterator back = mMapBuffObject.end(); while (front != back) { if ( dynamic_cast<SBuffCharacterObject*>(front->second)->isHaveAbsorbType(type) ) { deleteBuff(front); continue; } ++front; } }
//----------------------------------------------------------------------- void SBuffManager::deleteBuffByDisappearTypeEvent( STATUS_DISAPPEARTYPE type ) { std::map<UInt, BuffObject*>::iterator front = mMapBuffObject.begin(); std::map<UInt, BuffObject*>::iterator back = mMapBuffObject.end(); while (front != back) { if ( dynamic_cast<SBuffCharacterObject*>(front->second)->isCanDisappear(type) ) { deleteBuff(front); continue; } ++front; } }
void Character::deleteBuffWithIndex( int nIndex) { if(nIndex >= m_vBuff.size() || nIndex<0) { return; } BuffObject* pBuff = m_vBuff[nIndex]; if(!pBuff) { return; } m_vBuff.erase(m_vBuff.begin()+nIndex); deleteBuff(pBuff); }