mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 23:19:56 +00:00
55 lines
No EOL
1.1 KiB
C++
55 lines
No EOL
1.1 KiB
C++
|
|
#include "loadtes3.hpp"
|
|
|
|
#include "esmcommon.hpp"
|
|
#include "esmreader.hpp"
|
|
#include "esmwriter.hpp"
|
|
#include "defs.hpp"
|
|
|
|
void ESM::Header::blank()
|
|
{
|
|
mData.version = ESM::VER_13;
|
|
mData.type = 0;
|
|
mData.author.assign ("");
|
|
mData.desc.assign ("");
|
|
mData.records = 0;
|
|
mFormat = CurrentFormat;
|
|
mMaster.clear();
|
|
}
|
|
|
|
void ESM::Header::load (ESMReader &esm)
|
|
{
|
|
esm.getHNT (mData, "HEDR", 300);
|
|
|
|
if (esm.isNextSub ("FORM"))
|
|
{
|
|
esm.getHT (mFormat);
|
|
if (mFormat<0)
|
|
esm.fail ("invalid format code");
|
|
}
|
|
else
|
|
mFormat = 0;
|
|
|
|
while (esm.isNextSub ("MAST"))
|
|
{
|
|
MasterData m;
|
|
m.name = esm.getHString();
|
|
m.size = esm.getHNLong ("DATA");
|
|
mMaster.push_back (m);
|
|
}
|
|
}
|
|
|
|
void ESM::Header::save (ESMWriter &esm)
|
|
{
|
|
esm.writeHNT ("HEDR", mData, 300);
|
|
|
|
if (mFormat>0)
|
|
esm.writeHNT ("FORM", mFormat);
|
|
|
|
for (std::vector<Header::MasterData>::iterator iter = mMaster.begin();
|
|
iter != mMaster.end(); ++iter)
|
|
{
|
|
esm.writeHNCString ("MAST", iter->name);
|
|
esm.writeHNT ("DATA", iter->size);
|
|
}
|
|
} |