1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 20:49:56 +00:00
openmw-tes3mp/components/esm/globalscript.cpp

38 lines
785 B
C++
Raw Normal View History

#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_");
mTargetRef.unset();
if (esm.peekNextSub("TARG"))
mTargetId = esm.getHNString ("TARG");
if (esm.peekNextSub("FRMR"))
mTargetRef.load(esm, true, "FRMR");
}
void ESM::GlobalScript::save (ESMWriter &esm) const
{
esm.writeHNString ("NAME", mId);
mLocals.save (esm);
if (mRunning)
esm.writeHNT ("RUN_", mRunning);
if (!mTargetId.empty())
{
esm.writeHNOString ("TARG", mTargetId);
if (mTargetRef.hasContentFile())
mTargetRef.save (esm, true, "FRMR");
}
2015-03-11 14:54:45 +00:00
}