1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-19 12:40:49 +00:00
OpenMW/components/esm3/loadglob.cpp

51 lines
1004 B
C++
Raw Normal View History

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