Ejemplo n.º 1
0
bool monster_is_blacklisted(const mtype *m) {
    if(m == NULL || monster_whitelist.count(m->id) > 0) {
        return false;
    }
    for(std::set<std::string>::const_iterator b = monster_categories_whitelist.begin(); b != monster_categories_whitelist.end(); ++b) {
        if (m->categories.count(*b) > 0) {
            return false;
        }
    }
    for(std::set<std::string>::const_iterator b = monster_categories_blacklist.begin(); b != monster_categories_blacklist.end(); ++b) {
        if (m->categories.count(*b) > 0) {
            return true;
        }
    }
    if(monster_blacklist.count(m->id) > 0) {
        return true;
    }
    // Empty whitelist: default to enable all,
    // Non-empty whitelist: default to disable all.
    return !(monster_whitelist.empty() && monster_categories_whitelist.empty());
}
Ejemplo n.º 2
0
bool monster_is_blacklisted(const mtype *m)
{
    if(m == NULL || monster_whitelist.count(m->id) > 0) {
        return false;
    }
    for( const auto &elem : monster_categories_whitelist ) {
        if( m->categories.count( elem ) > 0 ) {
            return false;
        }
    }
    for( const auto &elem : monster_categories_blacklist ) {
        if( m->categories.count( elem ) > 0 ) {
            return true;
        }
    }
    if(monster_blacklist.count(m->id) > 0) {
        return true;
    }
    // Empty whitelist: default to enable all,
    // Non-empty whitelist: default to disable all.
    return !(monster_whitelist.empty() && monster_categories_whitelist.empty());
}