2013-12-15 16:16:50 +01:00
|
|
|
#include "globalscript.hpp"
|
|
|
|
|
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
|
|
|
|
|
|
|
void ESM::GlobalScript::load (ESMReader &esm)
|
|
|
|
{
|
|
|
|
mId = esm.getHNString ("NAME");
|
|
|
|
|
|
|
|
mLocals.load (esm);
|
|
|
|
|
|
|
|
mRunning = 0;
|
|
|
|
esm.getHNOT (mRunning, "RUN_");
|
2014-07-15 13:05:38 +02:00
|
|
|
|
2020-05-10 14:57:06 +02:00
|
|
|
mTargetRef.unset();
|
2021-05-05 22:23:06 +03:00
|
|
|
mTargetId = esm.getHNOString ("TARG");
|
2020-05-10 14:57:06 +02:00
|
|
|
if (esm.peekNextSub("FRMR"))
|
|
|
|
mTargetRef.load(esm, true, "FRMR");
|
2013-12-15 16:16:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ESM::GlobalScript::save (ESMWriter &esm) const
|
|
|
|
{
|
|
|
|
esm.writeHNString ("NAME", mId);
|
|
|
|
|
|
|
|
mLocals.save (esm);
|
|
|
|
|
|
|
|
if (mRunning)
|
|
|
|
esm.writeHNT ("RUN_", mRunning);
|
2014-07-15 13:05:38 +02:00
|
|
|
|
2020-05-10 14:57:06 +02:00
|
|
|
if (!mTargetId.empty())
|
|
|
|
{
|
|
|
|
esm.writeHNOString ("TARG", mTargetId);
|
2021-01-22 15:48:37 +01:00
|
|
|
if (mTargetRef.isSet())
|
2020-05-10 14:57:06 +02:00
|
|
|
mTargetRef.save (esm, true, "FRMR");
|
|
|
|
}
|
2015-03-11 10:54:45 -04:00
|
|
|
}
|