2011-04-06 16:11:08 +00:00
|
|
|
#include "loadbsgn.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
|
|
|
|
{
|
2013-09-24 11:17:28 +00:00
|
|
|
unsigned int BirthSign::sRecordId = REC_BSGN;
|
2011-04-06 16:11:08 +00:00
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
void BirthSign::load(ESMReader &esm, bool &isDeleted)
|
2015-02-12 03:56:05 +00:00
|
|
|
{
|
2015-07-20 14:23:14 +00:00
|
|
|
isDeleted = false;
|
|
|
|
|
2015-07-09 18:45:24 +00:00
|
|
|
mPowers.mList.clear();
|
|
|
|
|
2015-07-16 16:52:31 +00:00
|
|
|
bool hasName = false;
|
2015-07-09 18:45:24 +00:00
|
|
|
while (esm.hasMoreSubs())
|
2015-02-12 03:56:05 +00:00
|
|
|
{
|
2015-07-09 18:45:24 +00:00
|
|
|
esm.getSubName();
|
2016-05-07 17:32:51 +00:00
|
|
|
switch (esm.retSubName().intval)
|
2015-07-09 18:45:24 +00:00
|
|
|
{
|
2015-11-13 17:07:18 +00:00
|
|
|
case ESM::SREC_NAME:
|
2015-07-16 16:52:31 +00:00
|
|
|
mId = esm.getHString();
|
|
|
|
hasName = true;
|
|
|
|
break;
|
2015-07-09 18:45:24 +00:00
|
|
|
case ESM::FourCC<'F','N','A','M'>::value:
|
|
|
|
mName = esm.getHString();
|
|
|
|
break;
|
|
|
|
case ESM::FourCC<'T','N','A','M'>::value:
|
|
|
|
mTexture = esm.getHString();
|
|
|
|
break;
|
|
|
|
case ESM::FourCC<'D','E','S','C'>::value:
|
|
|
|
mDescription = esm.getHString();
|
|
|
|
break;
|
|
|
|
case ESM::FourCC<'N','P','C','S'>::value:
|
|
|
|
mPowers.add(esm);
|
|
|
|
break;
|
2015-11-13 17:07:18 +00:00
|
|
|
case ESM::SREC_DELE:
|
2015-07-20 14:23:14 +00:00
|
|
|
esm.skipHSub();
|
|
|
|
isDeleted = true;
|
|
|
|
break;
|
2015-07-09 18:45:24 +00:00
|
|
|
default:
|
|
|
|
esm.fail("Unknown subrecord");
|
2015-07-16 16:52:31 +00:00
|
|
|
break;
|
2015-07-09 18:45:24 +00:00
|
|
|
}
|
2015-02-12 03:56:05 +00:00
|
|
|
}
|
2015-07-16 16:52:31 +00:00
|
|
|
|
|
|
|
if (!hasName)
|
|
|
|
esm.fail("Missing NAME subrecord");
|
2015-02-12 03:56:05 +00:00
|
|
|
}
|
2012-09-17 07:37:50 +00:00
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
void BirthSign::save(ESMWriter &esm, bool isDeleted) const
|
2015-07-07 12:49:55 +00:00
|
|
|
{
|
2015-07-28 12:04:22 +00:00
|
|
|
esm.writeHNCString("NAME", mId);
|
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
if (isDeleted)
|
2015-07-09 18:45:24 +00:00
|
|
|
{
|
2015-07-16 16:52:31 +00:00
|
|
|
esm.writeHNCString("DELE", "");
|
2015-07-28 12:04:22 +00:00
|
|
|
return;
|
2015-07-09 18:45:24 +00:00
|
|
|
}
|
|
|
|
esm.writeHNOCString("FNAM", mName);
|
|
|
|
esm.writeHNOCString("TNAM", mTexture);
|
|
|
|
esm.writeHNOCString("DESC", mDescription);
|
2011-04-06 16:11:08 +00:00
|
|
|
|
2015-07-09 18:45:24 +00:00
|
|
|
mPowers.save(esm);
|
|
|
|
}
|
2011-04-06 16:11:08 +00:00
|
|
|
|
2013-04-07 18:26:39 +00:00
|
|
|
void BirthSign::blank()
|
|
|
|
{
|
|
|
|
mName.clear();
|
|
|
|
mDescription.clear();
|
|
|
|
mTexture.clear();
|
|
|
|
mPowers.mList.clear();
|
|
|
|
}
|
|
|
|
|
2011-04-06 16:11:08 +00:00
|
|
|
}
|