mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 03:56:39 +00:00 
			
		
		
		
	Fixed some types removed useless header applied clang format fixed compile tests fixed clang tidy, and closer to logic before this MR Removed hardcoded refids unless there is a returned value we don't use static RefIds can use == between RefId and hardcoded string Fix clang format Fixed a few instances where std::string was used, when only const std::string& was needed removed unused variable
		
			
				
	
	
		
			55 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#include "dialoguestate.hpp"
 | 
						|
 | 
						|
#include "esmreader.hpp"
 | 
						|
#include "esmwriter.hpp"
 | 
						|
 | 
						|
namespace ESM
 | 
						|
{
 | 
						|
 | 
						|
    void DialogueState::load(ESMReader& esm)
 | 
						|
    {
 | 
						|
        while (esm.isNextSub("TOPI"))
 | 
						|
            mKnownTopics.push_back(esm.getRefId());
 | 
						|
 | 
						|
        while (esm.isNextSub("FACT"))
 | 
						|
        {
 | 
						|
            ESM::RefId faction = esm.getRefId();
 | 
						|
 | 
						|
            while (esm.isNextSub("REA2"))
 | 
						|
            {
 | 
						|
                ESM::RefId faction2 = esm.getRefId();
 | 
						|
                int reaction;
 | 
						|
                esm.getHNT(reaction, "INTV");
 | 
						|
                mChangedFactionReaction[faction][faction2] = reaction;
 | 
						|
            }
 | 
						|
 | 
						|
            // no longer used
 | 
						|
            while (esm.isNextSub("REAC"))
 | 
						|
            {
 | 
						|
                esm.skipHSub();
 | 
						|
                esm.getSubName();
 | 
						|
                esm.skipHSub();
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    void DialogueState::save(ESMWriter& esm) const
 | 
						|
    {
 | 
						|
        for (auto iter(mKnownTopics.begin()); iter != mKnownTopics.end(); ++iter)
 | 
						|
        {
 | 
						|
            esm.writeHNString("TOPI", iter->getRefIdString());
 | 
						|
        }
 | 
						|
 | 
						|
        for (auto iter = mChangedFactionReaction.begin(); iter != mChangedFactionReaction.end(); ++iter)
 | 
						|
        {
 | 
						|
            esm.writeHNString("FACT", iter->first.getRefIdString());
 | 
						|
 | 
						|
            for (auto reactIter = iter->second.begin(); reactIter != iter->second.end(); ++reactIter)
 | 
						|
            {
 | 
						|
                esm.writeHNString("REA2", reactIter->first.getRefIdString());
 | 
						|
                esm.writeHNT("INTV", reactIter->second);
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
}
 |