void MonsterGroupManager::FinalizeMonsterGroups() { const MonsterGenerator &gen = MonsterGenerator::generator(); for(t_string_set::const_iterator a = monster_whitelist.begin(); a != monster_whitelist.end(); a++) { if (!gen.has_mtype(*a)) { debugmsg("monster on whitelist %s does not exist", a->c_str()); } } for(t_string_set::const_iterator a = monster_blacklist.begin(); a != monster_blacklist.end(); a++) { if (!gen.has_mtype(*a)) { debugmsg("monster on blacklist %s does not exist", a->c_str()); } } for(std::map<std::string, MonsterGroup>::iterator b = monsterGroupMap.begin(); b != monsterGroupMap.end(); ++b) { MonsterGroup &mg = b->second; for(FreqDef::iterator c = mg.monsters.begin(); c != mg.monsters.end(); ) { if(monster_is_blacklisted(gen.GetMType(c->name))) { c = mg.monsters.erase(c); } else { ++c; } } if(monster_is_blacklisted(gen.GetMType(mg.defaultMonster))) { mg.defaultMonster = "mon_null"; } } monster_blacklist.clear(); monster_whitelist.clear(); monster_categories_blacklist.clear(); monster_categories_whitelist.clear(); }
void MonsterGroupManager::FinalizeMonsterGroups() { const MonsterGenerator &gen = MonsterGenerator::generator(); for(t_string_set::const_iterator a = monster_whitelist.begin(); a != monster_whitelist.end(); a++) { if (!gen.has_mtype(*a)) { debugmsg("monster on whitelist %s does not exist", a->c_str()); } } for(t_string_set::const_iterator a = monster_blacklist.begin(); a != monster_blacklist.end(); a++) { if (!gen.has_mtype(*a)) { debugmsg("monster on blacklist %s does not exist", a->c_str()); } } for( auto &elem : monsterGroupMap ) { MonsterGroup &mg = elem.second; for(FreqDef::iterator c = mg.monsters.begin(); c != mg.monsters.end(); ) { if(monster_is_blacklisted(gen.GetMType(c->name))) { c = mg.monsters.erase(c); } else { ++c; } } if(monster_is_blacklisted(gen.GetMType(mg.defaultMonster))) { mg.defaultMonster = "mon_null"; } } }
bool Creature_tracker::add( monster &critter ) { if( critter.type->id == "mon_null" ) { // Don't wanna spawn null monsters o.O return false; } if( -1 != mon_at( critter.pos3() ) ) { debugmsg( "add_zombie: there's already a monster at %d,%d,%d", critter.posx(), critter.posy(), critter.posz() ); return false; } if( monster_is_blacklisted(critter.type) ) { return false; } monsters_by_location[critter.pos3()] = monsters_list.size(); monsters_list.push_back(new monster(critter)); return true; }