mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 15:19:55 +00:00
926c825d0c
Changed records are those where DELE is located after NAME sub-record. And DELE is the last sub-record.
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#include "loadacti.hpp"
|
|
|
|
#include "esmreader.hpp"
|
|
#include "esmwriter.hpp"
|
|
#include "defs.hpp"
|
|
#include "util.hpp"
|
|
|
|
namespace ESM
|
|
{
|
|
unsigned int Activator::sRecordId = REC_ACTI;
|
|
|
|
void Activator::load(ESMReader &esm)
|
|
{
|
|
mId = esm.getHNString("NAME");
|
|
if (mIsDeleted = readDeleSubRecord(esm))
|
|
{
|
|
return;
|
|
}
|
|
|
|
while (esm.hasMoreSubs())
|
|
{
|
|
esm.getSubName();
|
|
uint32_t name = esm.retSubName().val;
|
|
switch (name)
|
|
{
|
|
case ESM::FourCC<'M','O','D','L'>::value:
|
|
mModel = esm.getHString();
|
|
break;
|
|
case ESM::FourCC<'F','N','A','M'>::value:
|
|
mName = esm.getHString();
|
|
break;
|
|
case ESM::FourCC<'S','C','R','I'>::value:
|
|
mScript = esm.getHString();
|
|
break;
|
|
default:
|
|
esm.fail("Unknown subrecord");
|
|
}
|
|
}
|
|
}
|
|
void Activator::save(ESMWriter &esm) const
|
|
{
|
|
esm.writeHNCString("NAME", mId);
|
|
if (mIsDeleted)
|
|
{
|
|
writeDeleSubRecord(esm);
|
|
return;
|
|
}
|
|
|
|
esm.writeHNCString("MODL", mModel);
|
|
esm.writeHNOCString("FNAM", mName);
|
|
esm.writeHNOCString("SCRI", mScript);
|
|
}
|
|
|
|
void Activator::blank()
|
|
{
|
|
mName.clear();
|
|
mScript.clear();
|
|
mModel.clear();
|
|
mIsDeleted = false;
|
|
}
|
|
}
|