mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
61 lines
1.4 KiB
C++
61 lines
1.4 KiB
C++
#include "filter.hpp"
|
|
|
|
#include "esmreader.hpp"
|
|
#include "esmwriter.hpp"
|
|
|
|
namespace ESM
|
|
{
|
|
|
|
void Filter::load(ESMReader& esm, bool& isDeleted)
|
|
{
|
|
isDeleted = false;
|
|
mRecordFlags = esm.getRecordFlags();
|
|
|
|
while (esm.hasMoreSubs())
|
|
{
|
|
esm.getSubName();
|
|
uint32_t name = esm.retSubName().toInt();
|
|
switch (name)
|
|
{
|
|
case SREC_NAME:
|
|
mId = esm.getRefId();
|
|
break;
|
|
case fourCC("FILT"):
|
|
mFilter = esm.getHString();
|
|
break;
|
|
case fourCC("DESC"):
|
|
mDescription = esm.getHString();
|
|
break;
|
|
case SREC_DELE:
|
|
esm.skipHSub();
|
|
isDeleted = true;
|
|
break;
|
|
default:
|
|
esm.fail("Unknown subrecord");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
void Filter::save(ESMWriter& esm, bool isDeleted) const
|
|
{
|
|
esm.writeHNCRefId("NAME", mId);
|
|
|
|
if (isDeleted)
|
|
{
|
|
esm.writeHNString("DELE", "", 3);
|
|
return;
|
|
}
|
|
|
|
esm.writeHNCString("FILT", mFilter);
|
|
esm.writeHNCString("DESC", mDescription);
|
|
}
|
|
|
|
void Filter::blank()
|
|
{
|
|
mRecordFlags = 0;
|
|
mFilter.clear();
|
|
mDescription.clear();
|
|
}
|
|
|
|
}
|