mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 06:26:39 +00:00 
			
		
		
		
	Changed records are those where DELE is inserted at the beginning of a
record (before NAME).
The record has all required sub-records in this case.
(cherry picked from commit 9ac20a3355)
		
	
			
		
			
				
	
	
		
			66 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#include "loadbsgn.hpp"
 | 
						|
 | 
						|
#include "esmreader.hpp"
 | 
						|
#include "esmwriter.hpp"
 | 
						|
#include "defs.hpp"
 | 
						|
#include "util.hpp"
 | 
						|
 | 
						|
namespace ESM
 | 
						|
{
 | 
						|
    unsigned int BirthSign::sRecordId = REC_BSGN;
 | 
						|
 | 
						|
void BirthSign::load(ESMReader &esm)
 | 
						|
{
 | 
						|
    mPowers.mList.clear();
 | 
						|
 | 
						|
    mIsDeleted = readDeleSubRecord(esm);
 | 
						|
    mId = esm.getHNString("NAME");
 | 
						|
 | 
						|
    while (esm.hasMoreSubs())
 | 
						|
    {
 | 
						|
        esm.getSubName();
 | 
						|
        uint32_t name = esm.retSubName().val;
 | 
						|
        switch (name)
 | 
						|
        {
 | 
						|
            case ESM::FourCC<'F','N','A','M'>::value:
 | 
						|
                mName = esm.getHString();
 | 
						|
                break;
 | 
						|
            case ESM::FourCC<'T','N','A','M'>::value:
 | 
						|
                mTexture = esm.getHString();
 | 
						|
                break;
 | 
						|
            case ESM::FourCC<'D','E','S','C'>::value:
 | 
						|
                mDescription = esm.getHString();
 | 
						|
                break;
 | 
						|
            case ESM::FourCC<'N','P','C','S'>::value:
 | 
						|
                mPowers.add(esm);
 | 
						|
                break;
 | 
						|
            default:
 | 
						|
                esm.fail("Unknown subrecord");
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
void BirthSign::save(ESMWriter &esm) const
 | 
						|
{
 | 
						|
    if (mIsDeleted)
 | 
						|
    {
 | 
						|
        writeDeleSubRecord(esm);
 | 
						|
    }
 | 
						|
    esm.writeHNCString("NAME", mId);
 | 
						|
    esm.writeHNOCString("FNAM", mName);
 | 
						|
    esm.writeHNOCString("TNAM", mTexture);
 | 
						|
    esm.writeHNOCString("DESC", mDescription);
 | 
						|
 | 
						|
    mPowers.save(esm);
 | 
						|
}
 | 
						|
 | 
						|
    void BirthSign::blank()
 | 
						|
    {
 | 
						|
        mName.clear();
 | 
						|
        mDescription.clear();
 | 
						|
        mTexture.clear();
 | 
						|
        mPowers.mList.clear();
 | 
						|
        mIsDeleted = false;
 | 
						|
    }
 | 
						|
 | 
						|
}
 |