You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/components/esm/loadcrea.cpp

54 lines
1.1 KiB
C++

#include "loadcrea.hpp"
#include "esm_reader.hpp"
#include "esm_writer.hpp"
namespace ESM {
void Creature::load(ESMReader &esm)
{
mModel = esm.getHNString("MODL");
mOriginal = esm.getHNOString("CNAM");
mName = esm.getHNOString("FNAM");
mScript = esm.getHNOString("SCRI");
esm.getHNT(mData, "NPDT", 96);
esm.getHNT(mFlags, "FLAG");
mScale = 1.0;
esm.getHNOT(mScale, "XSCL");
mInventory.load(esm);
13 years ago
mSpells.load(esm);
if (esm.isNextSub("AIDT"))
{
13 years ago
esm.getHExact(&mAiData, sizeof(mAiData));
mHasAI = true;
}
else
13 years ago
mHasAI = false;
13 years ago
mAiPackage.load(esm);
esm.skipRecord();
}
void Creature::save(ESMWriter &esm)
{
esm.writeHNCString("MODL", mModel);
esm.writeHNOCString("CNAM", mOriginal);
esm.writeHNOCString("FNAM", mName);
esm.writeHNOCString("SCRI", mScript);
esm.writeHNT("NPDT", mData, 96);
esm.writeHNT("FLAG", mFlags);
if (mScale != 1.0) {
esm.writeHNT("XSCL", mScale);
}
mInventory.save(esm);
mSpells.save(esm);
mAiPackage.save(esm);
}
}