mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 22:26:45 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			833 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			833 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "blacklist.hpp"
 | |
| 
 | |
| #include <algorithm>
 | |
| 
 | |
| #include <components/misc/stringops.hpp>
 | |
| 
 | |
| bool CSMDoc::Blacklist::isBlacklisted (const CSMWorld::UniversalId& id) const
 | |
| {
 | |
|     std::map<CSMWorld::UniversalId::Type, std::vector<std::string> >::const_iterator iter =
 | |
|         mIds.find (id.getType());
 | |
| 
 | |
|     if (iter==mIds.end())
 | |
|         return false;
 | |
| 
 | |
|     return std::binary_search (iter->second.begin(), iter->second.end(),
 | |
|         Misc::StringUtils::lowerCase (id.getId()));
 | |
| }
 | |
| 
 | |
| void CSMDoc::Blacklist::add (CSMWorld::UniversalId::Type type,
 | |
|     const std::vector<std::string>& ids)
 | |
| {
 | |
|     std::vector<std::string>& list = mIds[type];
 | |
| 
 | |
|     int size = list.size();
 | |
| 
 | |
|     list.resize (size+ids.size());
 | |
| 
 | |
|     std::transform (ids.begin(), ids.end(), list.begin()+size, Misc::StringUtils::lowerCase);
 | |
|     std::sort (list.begin(), list.end());
 | |
| }
 |