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
87
components/esm3/loadappa.cpp
Normal file
87
components/esm3/loadappa.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
#include "loadappa.hpp"
|
||||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "components/esm/defs.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
unsigned int Apparatus::sRecordId = REC_APPA;
|
||||
|
||||
void Apparatus::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
bool hasName = false;
|
||||
bool hasData = false;
|
||||
while (esm.hasMoreSubs())
|
||||
{
|
||||
esm.getSubName();
|
||||
switch (esm.retSubName().toInt())
|
||||
{
|
||||
case ESM::SREC_NAME:
|
||||
mId = esm.getHString();
|
||||
hasName = true;
|
||||
break;
|
||||
case ESM::FourCC<'M','O','D','L'>::value:
|
||||
mModel = esm.getHString();
|
||||
break;
|
||||
case ESM::FourCC<'F','N','A','M'>::value:
|
||||
mName = esm.getHString();
|
||||
break;
|
||||
case ESM::FourCC<'A','A','D','T'>::value:
|
||||
esm.getHT(mData);
|
||||
hasData = true;
|
||||
break;
|
||||
case ESM::FourCC<'S','C','R','I'>::value:
|
||||
mScript = esm.getHString();
|
||||
break;
|
||||
case ESM::FourCC<'I','T','E','X'>::value:
|
||||
mIcon = esm.getHString();
|
||||
break;
|
||||
case ESM::SREC_DELE:
|
||||
esm.skipHSub();
|
||||
isDeleted = true;
|
||||
break;
|
||||
default:
|
||||
esm.fail("Unknown subrecord");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasName)
|
||||
esm.fail("Missing NAME subrecord");
|
||||
if (!hasData && !isDeleted)
|
||||
esm.fail("Missing AADT subrecord");
|
||||
}
|
||||
|
||||
void Apparatus::save(ESMWriter &esm, bool isDeleted) const
|
||||
{
|
||||
esm.writeHNCString("NAME", mId);
|
||||
|
||||
if (isDeleted)
|
||||
{
|
||||
esm.writeHNString("DELE", "", 3);
|
||||
return;
|
||||
}
|
||||
|
||||
esm.writeHNCString("MODL", mModel);
|
||||
esm.writeHNCString("FNAM", mName);
|
||||
esm.writeHNT("AADT", mData, 16);
|
||||
esm.writeHNOCString("SCRI", mScript);
|
||||
esm.writeHNCString("ITEX", mIcon);
|
||||
}
|
||||
|
||||
void Apparatus::blank()
|
||||
{
|
||||
mData.mType = 0;
|
||||
mData.mQuality = 0;
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
mName.clear();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue