2011-04-08 17:58:21 +04:00
|
|
|
#include "loadglob.hpp"
|
|
|
|
|
2015-07-08 00:04:14 +03:00
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
2013-09-24 13:17:28 +02:00
|
|
|
|
2011-04-08 17:58:21 +04:00
|
|
|
namespace ESM
|
|
|
|
{
|
2015-07-20 17:23:14 +03:00
|
|
|
void Global::load(ESMReader& esm, bool& isDeleted)
|
2013-02-28 11:50:29 +01:00
|
|
|
{
|
2015-07-20 17:23:14 +03:00
|
|
|
isDeleted = false;
|
2021-07-25 19:53:41 +10:00
|
|
|
mRecordFlags = esm.getRecordFlags();
|
2015-07-20 17:23:14 +03:00
|
|
|
|
2023-02-12 19:36:56 +01:00
|
|
|
mId = esm.getHNRefId("NAME");
|
2015-07-16 19:52:31 +03:00
|
|
|
|
|
|
|
if (esm.isNextSub("DELE"))
|
2015-07-08 00:04:14 +03:00
|
|
|
{
|
2015-07-16 19:52:31 +03:00
|
|
|
esm.skipHSub();
|
2015-07-20 17:23:14 +03:00
|
|
|
isDeleted = true;
|
2015-07-16 19:52:31 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-04-12 00:18:39 +02:00
|
|
|
mValue.read(esm, Variant::Format_Global);
|
2015-07-08 00:04:14 +03:00
|
|
|
}
|
2013-02-28 11:50:29 +01:00
|
|
|
}
|
2011-04-08 17:58:21 +04:00
|
|
|
|
2015-07-20 17:23:14 +03:00
|
|
|
void Global::save(ESMWriter& esm, bool isDeleted) const
|
2012-04-06 21:04:30 +02:00
|
|
|
{
|
2023-02-12 19:36:56 +01:00
|
|
|
esm.writeHNCRefId("NAME", mId);
|
2015-07-16 19:52:31 +03:00
|
|
|
|
2015-07-20 17:23:14 +03:00
|
|
|
if (isDeleted)
|
2015-07-08 00:04:14 +03:00
|
|
|
{
|
2015-07-16 19:52:31 +03:00
|
|
|
esm.writeHNCString("DELE", "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-04-12 00:18:39 +02:00
|
|
|
mValue.write(esm, Variant::Format_Global);
|
2015-07-08 00:04:14 +03:00
|
|
|
}
|
2012-04-06 21:04:30 +02:00
|
|
|
}
|
2011-04-08 17:58:21 +04:00
|
|
|
|
2012-12-03 22:16:02 +01:00
|
|
|
void Global::blank()
|
|
|
|
{
|
2022-05-29 22:12:30 +02:00
|
|
|
mRecordFlags = 0;
|
2022-04-12 00:18:39 +02:00
|
|
|
mValue.setType(VT_None);
|
2012-12-03 22:16:02 +01:00
|
|
|
}
|
|
|
|
|
2012-11-29 14:45:34 +01:00
|
|
|
bool operator==(const Global& left, const Global& right)
|
|
|
|
{
|
2013-03-04 14:32:59 +01:00
|
|
|
return left.mId == right.mId && left.mValue == right.mValue;
|
2012-11-29 14:45:34 +01:00
|
|
|
}
|
2011-04-08 17:58:21 +04:00
|
|
|
}
|