mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 04:56:39 +00:00 
			
		
		
		
	Nice side effects: - Subrecord name comparison now uses magic number instead of string (faster) - Improves the error message for unknown subrecords: will print the record in question instead of failing to read the next record with a strange error
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			621 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			621 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include "spelllist.hpp"
 | 
						|
 | 
						|
#include "esmreader.hpp"
 | 
						|
#include "esmwriter.hpp"
 | 
						|
 | 
						|
namespace ESM {
 | 
						|
 | 
						|
void SpellList::add(ESMReader &esm)
 | 
						|
{
 | 
						|
    mList.push_back(esm.getHString());
 | 
						|
}
 | 
						|
 | 
						|
void SpellList::save(ESMWriter &esm) const
 | 
						|
{
 | 
						|
    for (std::vector<std::string>::const_iterator it = mList.begin(); it != mList.end(); ++it) {
 | 
						|
        esm.writeHNString("NPCS", *it, 32);
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
bool SpellList::exists(const std::string &spell) const
 | 
						|
{
 | 
						|
    for (std::vector<std::string>::const_iterator it = mList.begin(); it != mList.end(); ++it)
 | 
						|
        if (Misc::StringUtils::ciEqual(*it, spell))
 | 
						|
            return true;
 | 
						|
    return false;
 | 
						|
}
 | 
						|
 | 
						|
}
 |