2011-04-08 13:58:21 +00:00
|
|
|
#include "loadglob.hpp"
|
|
|
|
|
2015-07-07 21:04:14 +00:00
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
2013-09-24 11:17:28 +00:00
|
|
|
#include "defs.hpp"
|
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2013-09-24 11:17:28 +00:00
|
|
|
unsigned int Global::sRecordId = REC_GLOB;
|
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
void Global::load (ESMReader &esm, bool &isDeleted)
|
2013-02-28 10:50:29 +00:00
|
|
|
{
|
2015-07-20 14:23:14 +00:00
|
|
|
isDeleted = false;
|
|
|
|
|
2015-07-16 16:52:31 +00:00
|
|
|
mId = esm.getHNString ("NAME");
|
|
|
|
|
|
|
|
if (esm.isNextSub ("DELE"))
|
2015-07-07 21:04:14 +00:00
|
|
|
{
|
2015-07-16 16:52:31 +00:00
|
|
|
esm.skipHSub();
|
2015-07-20 14:23:14 +00:00
|
|
|
isDeleted = true;
|
2015-07-16 16:52:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mValue.read (esm, ESM::Variant::Format_Global);
|
2015-07-07 21:04:14 +00:00
|
|
|
}
|
2013-02-28 10:50:29 +00:00
|
|
|
}
|
2011-04-08 13:58:21 +00:00
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
void Global::save (ESMWriter &esm, bool isDeleted) const
|
2012-04-06 19:04:30 +00:00
|
|
|
{
|
2015-07-16 16:52:31 +00:00
|
|
|
esm.writeHNCString ("NAME", mId);
|
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
if (isDeleted)
|
2015-07-07 21:04:14 +00:00
|
|
|
{
|
2015-07-16 16:52:31 +00:00
|
|
|
esm.writeHNCString ("DELE", "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mValue.write (esm, ESM::Variant::Format_Global);
|
2015-07-07 21:04:14 +00:00
|
|
|
}
|
2012-04-06 19:04:30 +00:00
|
|
|
}
|
2011-04-08 13:58:21 +00:00
|
|
|
|
2012-12-03 21:16:02 +00:00
|
|
|
void Global::blank()
|
|
|
|
{
|
2013-03-04 13:32:59 +00:00
|
|
|
mValue.setType (ESM::VT_None);
|
2012-12-03 21:16:02 +00:00
|
|
|
}
|
|
|
|
|
2012-11-29 13:45:34 +00:00
|
|
|
bool operator== (const Global& left, const Global& right)
|
|
|
|
{
|
2013-03-04 13:32:59 +00:00
|
|
|
return left.mId==right.mId && left.mValue==right.mValue;
|
2012-11-29 13:45:34 +00:00
|
|
|
}
|
2011-04-08 13:58:21 +00:00
|
|
|
}
|