1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 12:53:53 +00:00
openmw/components/esm3/loadstat.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.4 KiB
C++
Raw Normal View History

#include "loadstat.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
2012-09-17 07:37:50 +00:00
namespace ESM
{
void Static::load(ESMReader& esm, bool& isDeleted)
{
isDeleted = false;
mRecordFlags = esm.getRecordFlags();
// bool isBlocked = (mRecordFlags & FLAG_Blocked) != 0;
// bool isPersistent = (mRecordFlags & FLAG_Persistent) != 0;
bool hasName = false;
while (esm.hasMoreSubs())
{
esm.getSubName();
switch (esm.retSubName().toInt())
{
case SREC_NAME:
mId = esm.getHString();
hasName = true;
break;
case fourCC("MODL"):
mModel = esm.getHString();
break;
case SREC_DELE:
esm.skipHSub();
isDeleted = true;
break;
default:
esm.fail("Unknown subrecord");
break;
}
}
if (!hasName)
esm.fail("Missing NAME subrecord");
}
void Static::save(ESMWriter& esm, bool isDeleted) const
{
esm.writeHNCString("NAME", mId);
if (isDeleted)
{
esm.writeHNString("DELE", "", 3);
}
else
{
esm.writeHNCString("MODL", mModel);
}
}
void Static::blank()
{
2022-05-29 20:12:30 +00:00
mRecordFlags = 0;
mModel.clear();
}
}