2011-04-06 16:11:08 +00:00
|
|
|
#include "loadarmo.hpp"
|
|
|
|
|
2012-09-23 18:41:41 +00:00
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
2013-09-24 11:17:28 +00:00
|
|
|
#include "defs.hpp"
|
2012-09-17 07:37:50 +00:00
|
|
|
|
2011-04-06 16:11:08 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
|
|
|
void PartReferenceList::load(ESMReader &esm)
|
|
|
|
{
|
|
|
|
while (esm.isNextSub("INDX"))
|
|
|
|
{
|
|
|
|
PartReference pr;
|
2012-09-17 07:37:50 +00:00
|
|
|
esm.getHT(pr.mPart); // The INDX byte
|
|
|
|
pr.mMale = esm.getHNOString("BNAM");
|
|
|
|
pr.mFemale = esm.getHNOString("CNAM");
|
|
|
|
mParts.push_back(pr);
|
2012-04-06 19:04:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-16 10:32:35 +00:00
|
|
|
void PartReferenceList::save(ESMWriter &esm) const
|
2012-04-06 19:04:30 +00:00
|
|
|
{
|
2013-09-16 10:32:35 +00:00
|
|
|
for (std::vector<PartReference>::const_iterator it = mParts.begin(); it != mParts.end(); ++it)
|
2012-04-06 19:04:30 +00:00
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
esm.writeHNT("INDX", it->mPart);
|
|
|
|
esm.writeHNOString("BNAM", it->mMale);
|
|
|
|
esm.writeHNOString("CNAM", it->mFemale);
|
2011-04-06 16:11:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 11:17:28 +00:00
|
|
|
unsigned int Armor::sRecordId = REC_ARMO;
|
|
|
|
|
2011-04-06 16:11:08 +00:00
|
|
|
void Armor::load(ESMReader &esm)
|
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
mModel = esm.getHNString("MODL");
|
2014-04-13 11:23:50 +00:00
|
|
|
mName = esm.getHNOString("FNAM");
|
2012-09-17 07:37:50 +00:00
|
|
|
mScript = esm.getHNOString("SCRI");
|
|
|
|
esm.getHNT(mData, "AODT", 24);
|
|
|
|
mIcon = esm.getHNOString("ITEX");
|
|
|
|
mParts.load(esm);
|
|
|
|
mEnchant = esm.getHNOString("ENAM");
|
2011-04-06 16:11:08 +00:00
|
|
|
}
|
|
|
|
|
2013-09-16 10:32:35 +00:00
|
|
|
void Armor::save(ESMWriter &esm) const
|
2012-04-06 19:04:30 +00:00
|
|
|
{
|
2012-09-17 07:37:50 +00:00
|
|
|
esm.writeHNCString("MODL", mModel);
|
2014-04-13 11:23:50 +00:00
|
|
|
esm.writeHNOCString("FNAM", mName);
|
2012-09-17 07:37:50 +00:00
|
|
|
esm.writeHNOCString("SCRI", mScript);
|
|
|
|
esm.writeHNT("AODT", mData, 24);
|
|
|
|
esm.writeHNOCString("ITEX", mIcon);
|
|
|
|
mParts.save(esm);
|
|
|
|
esm.writeHNOCString("ENAM", mEnchant);
|
2011-04-06 16:11:08 +00:00
|
|
|
}
|
|
|
|
|
2013-05-06 12:10:43 +00:00
|
|
|
void Armor::blank()
|
|
|
|
{
|
|
|
|
mData.mType = 0;
|
|
|
|
mData.mWeight = 0;
|
|
|
|
mData.mValue = 0;
|
|
|
|
mData.mHealth = 0;
|
|
|
|
mData.mEnchant = 0;
|
|
|
|
mData.mArmor = 0;
|
|
|
|
mParts.mParts.clear();
|
|
|
|
mName.clear();
|
|
|
|
mModel.clear();
|
|
|
|
mIcon.clear();
|
|
|
|
mScript.clear();
|
|
|
|
mEnchant.clear();
|
|
|
|
}
|
2011-04-06 16:11:08 +00:00
|
|
|
}
|