1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 07:53:52 +00:00
openmw/components/esm3/loadglob.cpp

51 lines
1,002 B
C++
Raw Normal View History

#include "loadglob.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
2022-09-22 18:26:05 +00:00
void Global::load(ESMReader& esm, bool& isDeleted)
2013-02-28 10:50:29 +00:00
{
isDeleted = false;
mRecordFlags = esm.getRecordFlags();
mId = esm.getHNRefId("NAME");
2022-09-22 18:26:05 +00:00
if (esm.isNextSub("DELE"))
{
esm.skipHSub();
isDeleted = true;
}
else
{
2022-09-22 18:26:05 +00:00
mValue.read(esm, Variant::Format_Global);
}
2013-02-28 10:50:29 +00:00
}
2022-09-22 18:26:05 +00:00
void Global::save(ESMWriter& esm, bool isDeleted) const
{
esm.writeHNCRefId("NAME", mId);
if (isDeleted)
{
2022-09-22 18:26:05 +00:00
esm.writeHNCString("DELE", "");
}
else
{
2022-09-22 18:26:05 +00:00
mValue.write(esm, Variant::Format_Global);
}
}
2012-12-03 21:16:02 +00:00
void Global::blank()
{
2022-05-29 20:12:30 +00:00
mRecordFlags = 0;
2022-09-22 18:26:05 +00:00
mValue.setType(VT_None);
2012-12-03 21:16:02 +00:00
}
2022-09-22 18:26:05 +00:00
bool operator==(const Global& left, const Global& right)
{
2022-09-22 18:26:05 +00:00
return left.mId == right.mId && left.mValue == right.mValue;
}
}