mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
move most of the files from esm to esm3, keep common code in esm; this is make space for a future with esm4
esm typo esm typo
This commit is contained in:
parent
c263bbf0f6
commit
d1fb854521
448 changed files with 686 additions and 683 deletions
58
components/esm3/filter.cpp
Normal file
58
components/esm3/filter.cpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
#include "filter.hpp"
|
||||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "components/esm/defs.hpp"
|
||||
|
||||
unsigned int ESM::Filter::sRecordId = REC_FILT;
|
||||
|
||||
void ESM::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 ESM::SREC_NAME:
|
||||
mId = esm.getHString();
|
||||
break;
|
||||
case ESM::FourCC<'F','I','L','T'>::value:
|
||||
mFilter = esm.getHString();
|
||||
break;
|
||||
case ESM::FourCC<'D','E','S','C'>::value:
|
||||
mDescription = esm.getHString();
|
||||
break;
|
||||
case ESM::SREC_DELE:
|
||||
esm.skipHSub();
|
||||
isDeleted = true;
|
||||
break;
|
||||
default:
|
||||
esm.fail("Unknown subrecord");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ESM::Filter::save (ESMWriter& esm, bool isDeleted) const
|
||||
{
|
||||
esm.writeHNCString ("NAME", mId);
|
||||
|
||||
if (isDeleted)
|
||||
{
|
||||
esm.writeHNString("DELE", "", 3);
|
||||
return;
|
||||
}
|
||||
|
||||
esm.writeHNCString ("FILT", mFilter);
|
||||
esm.writeHNCString ("DESC", mDescription);
|
||||
}
|
||||
|
||||
void ESM::Filter::blank()
|
||||
{
|
||||
mFilter.clear();
|
||||
mDescription.clear();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue