bool CRecastContainer::Has(RECASTTYPE type, uint16 id) { RecastList_t* PRecastList = GetRecastList(type); return std::find_if(PRecastList->begin(), PRecastList->end(), [&id](auto& recast) { return recast.ID == id; }) != PRecastList->end(); }
void CRecastContainer::Del(RECASTTYPE type, uint16 id) { RecastList_t* PRecastList = GetRecastList(type); if (type == RECAST_ABILITY) { if (auto recast = GetRecast(RECAST_ABILITY, id)) { recast->RecastTime = 0; } } else { PRecastList->erase(std::remove_if(PRecastList->begin(), PRecastList->end(), [&id](auto& recast) { return recast.ID == id; }), PRecastList->end()); } }
Recast_t* CRecastContainer::GetRecast(RECASTTYPE type, uint16 id) { RecastList_t* list = GetRecastList(type); for (std::vector<Recast_t*>::iterator it = list->begin() ; it != list->end(); ++it) { Recast_t* recast = *it; if( recast->ID == id) { return recast; } } return NULL; }