Set Deleted flag to false when initializing ESM records

openmw-38
Stanislav Bas 10 years ago
parent 20723581a1
commit 7ecb54a776

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Activator::sRecordId = REC_ACTI; unsigned int Activator::sRecordId = REC_ACTI;
Activator::Activator()
: mIsDeleted(false)
{}
void Activator::load(ESMReader &esm) void Activator::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -19,6 +19,8 @@ struct Activator
bool mIsDeleted; bool mIsDeleted;
Activator();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Potion::sRecordId = REC_ALCH; unsigned int Potion::sRecordId = REC_ALCH;
Potion::Potion()
: mIsDeleted(false)
{}
void Potion::load(ESMReader &esm) void Potion::load(ESMReader &esm)
{ {
mEffects.mList.clear(); mEffects.mList.clear();

@ -35,6 +35,8 @@ struct Potion
bool mIsDeleted; bool mIsDeleted;
Potion();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,8 +9,12 @@ namespace ESM
{ {
unsigned int Apparatus::sRecordId = REC_APPA; unsigned int Apparatus::sRecordId = REC_APPA;
void Apparatus::load(ESMReader &esm) Apparatus::Apparatus()
{ : mIsDeleted(false)
{}
void Apparatus::load(ESMReader &esm)
{
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");
if (mIsDeleted = readDeleSubRecord(esm)) if (mIsDeleted = readDeleSubRecord(esm))
{ {
@ -46,10 +50,10 @@ void Apparatus::load(ESMReader &esm)
} }
if (!hasData) if (!hasData)
esm.fail("Missing AADT"); esm.fail("Missing AADT");
} }
void Apparatus::save(ESMWriter &esm) const void Apparatus::save(ESMWriter &esm) const
{ {
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);
if (mIsDeleted) if (mIsDeleted)
{ {
@ -62,7 +66,7 @@ void Apparatus::save(ESMWriter &esm) const
esm.writeHNT("AADT", mData, 16); esm.writeHNT("AADT", mData, 16);
esm.writeHNOCString("SCRI", mScript); esm.writeHNOCString("SCRI", mScript);
esm.writeHNCString("ITEX", mIcon); esm.writeHNCString("ITEX", mIcon);
} }
void Apparatus::blank() void Apparatus::blank()
{ {

@ -40,6 +40,8 @@ struct Apparatus
bool mIsDeleted; bool mIsDeleted;
Apparatus();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -39,6 +39,10 @@ namespace ESM
unsigned int Armor::sRecordId = REC_ARMO; unsigned int Armor::sRecordId = REC_ARMO;
Armor::Armor()
: mIsDeleted(false)
{}
void Armor::load(ESMReader &esm) void Armor::load(ESMReader &esm)
{ {
mParts.mParts.clear(); mParts.mParts.clear();

@ -98,6 +98,8 @@ struct Armor
bool mIsDeleted; bool mIsDeleted;
Armor();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,9 +9,12 @@ namespace ESM
{ {
unsigned int BodyPart::sRecordId = REC_BODY; unsigned int BodyPart::sRecordId = REC_BODY;
BodyPart::BodyPart()
: mIsDeleted(false)
{}
void BodyPart::load(ESMReader &esm) void BodyPart::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");
if (mIsDeleted = readDeleSubRecord(esm)) if (mIsDeleted = readDeleSubRecord(esm))
{ {
@ -42,9 +45,10 @@ void BodyPart::load(ESMReader &esm)
if (!hasData) if (!hasData)
esm.fail("Missing BYDT subrecord"); esm.fail("Missing BYDT subrecord");
} }
void BodyPart::save(ESMWriter &esm) const
{ void BodyPart::save(ESMWriter &esm) const
{
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);
if (mIsDeleted) if (mIsDeleted)
{ {
@ -55,7 +59,7 @@ void BodyPart::save(ESMWriter &esm) const
esm.writeHNCString("MODL", mModel); esm.writeHNCString("MODL", mModel);
esm.writeHNOCString("FNAM", mRace); esm.writeHNOCString("FNAM", mRace);
esm.writeHNT("BYDT", mData, 4); esm.writeHNT("BYDT", mData, 4);
} }
void BodyPart::blank() void BodyPart::blank()
{ {

@ -62,6 +62,8 @@ struct BodyPart
bool mIsDeleted; bool mIsDeleted;
BodyPart();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Book::sRecordId = REC_BOOK; unsigned int Book::sRecordId = REC_BOOK;
Book::Book()
: mIsDeleted(false)
{}
void Book::load(ESMReader &esm) void Book::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -30,6 +30,8 @@ struct Book
bool mIsDeleted; bool mIsDeleted;
Book();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,8 +9,12 @@ namespace ESM
{ {
unsigned int BirthSign::sRecordId = REC_BSGN; unsigned int BirthSign::sRecordId = REC_BSGN;
void BirthSign::load(ESMReader &esm) BirthSign::BirthSign()
{ : mIsDeleted(false)
{}
void BirthSign::load(ESMReader &esm)
{
mPowers.mList.clear(); mPowers.mList.clear();
mIsDeleted = readDeleSubRecord(esm); mIsDeleted = readDeleSubRecord(esm);
@ -38,10 +42,10 @@ void BirthSign::load(ESMReader &esm)
esm.fail("Unknown subrecord"); esm.fail("Unknown subrecord");
} }
} }
} }
void BirthSign::save(ESMWriter &esm) const void BirthSign::save(ESMWriter &esm) const
{ {
if (mIsDeleted) if (mIsDeleted)
{ {
writeDeleSubRecord(esm); writeDeleSubRecord(esm);
@ -52,7 +56,7 @@ void BirthSign::save(ESMWriter &esm) const
esm.writeHNOCString("DESC", mDescription); esm.writeHNOCString("DESC", mDescription);
mPowers.save(esm); mPowers.save(esm);
} }
void BirthSign::blank() void BirthSign::blank()
{ {

@ -24,6 +24,8 @@ struct BirthSign
bool mIsDeleted; bool mIsDeleted;
BirthSign();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -85,7 +85,8 @@ struct Cell
mWater(0), mWater(0),
mWaterInt(false), mWaterInt(false),
mMapColor(0), mMapColor(0),
mRefNumCounter(0) mRefNumCounter(0),
mIsDeleted(false)
{} {}
// Interior cells are indexed by this (it's the 'id'), for exterior // Interior cells are indexed by this (it's the 'id'), for exterior

@ -23,6 +23,9 @@ namespace ESM
"sSpecializationStealth" "sSpecializationStealth"
}; };
Class::Class()
: mIsDeleted(false)
{}
int& Class::CLDTstruct::getSkill (int index, bool major) int& Class::CLDTstruct::getSkill (int index, bool major)
{ {

@ -75,6 +75,8 @@ struct Class
bool mIsDeleted; bool mIsDeleted;
Class();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Clothing::sRecordId = REC_CLOT; unsigned int Clothing::sRecordId = REC_CLOT;
Clothing::Clothing()
: mIsDeleted(false)
{}
void Clothing::load(ESMReader &esm) void Clothing::load(ESMReader &esm)
{ {
mParts.mParts.clear(); mParts.mParts.clear();

@ -50,6 +50,8 @@ struct Clothing
bool mIsDeleted; bool mIsDeleted;
Clothing();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -25,6 +25,10 @@ namespace ESM
unsigned int Container::sRecordId = REC_CONT; unsigned int Container::sRecordId = REC_CONT;
Container::Container()
: mIsDeleted(false)
{}
void Container::load(ESMReader &esm) void Container::load(ESMReader &esm)
{ {
mInventory.mList.clear(); mInventory.mList.clear();

@ -54,6 +54,8 @@ struct Container
bool mIsDeleted; bool mIsDeleted;
Container();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM {
unsigned int Creature::sRecordId = REC_CREA; unsigned int Creature::sRecordId = REC_CREA;
Creature::Creature()
: mIsDeleted(false)
{}
void Creature::load(ESMReader &esm) void Creature::load(ESMReader &esm)
{ {
mPersistent = (esm.getRecordFlags() & 0x0400) != 0; mPersistent = (esm.getRecordFlags() & 0x0400) != 0;

@ -98,6 +98,8 @@ struct Creature
bool mIsDeleted; bool mIsDeleted;
Creature();
const std::vector<Transport::Dest>& getTransport() const; const std::vector<Transport::Dest>& getTransport() const;
void load(ESMReader &esm); void load(ESMReader &esm);

@ -13,8 +13,12 @@ namespace ESM
{ {
unsigned int Dialogue::sRecordId = REC_DIAL; unsigned int Dialogue::sRecordId = REC_DIAL;
void Dialogue::load(ESMReader &esm) Dialogue::Dialogue()
{ : mIsDeleted(false)
{}
void Dialogue::load(ESMReader &esm)
{
mIsDeleted = false; mIsDeleted = false;
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");
@ -31,10 +35,10 @@ void Dialogue::load(ESMReader &esm)
} }
else else
esm.fail("Unknown sub record size"); esm.fail("Unknown sub record size");
} }
void Dialogue::save(ESMWriter &esm) const void Dialogue::save(ESMWriter &esm) const
{ {
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);
if (mIsDeleted) if (mIsDeleted)
{ {
@ -45,15 +49,15 @@ void Dialogue::save(ESMWriter &esm) const
{ {
esm.writeHNT("DATA", mType); esm.writeHNT("DATA", mType);
} }
} }
void Dialogue::blank() void Dialogue::blank()
{ {
mInfo.clear(); mInfo.clear();
} }
void Dialogue::readInfo(ESMReader &esm, bool merge) void Dialogue::readInfo(ESMReader &esm, bool merge)
{ {
const std::string& id = esm.getHNOString("INAM"); const std::string& id = esm.getHNOString("INAM");
if (!merge || mInfo.empty()) if (!merge || mInfo.empty())
@ -121,10 +125,10 @@ void Dialogue::readInfo(ESMReader &esm, bool merge)
} }
std::cerr << "Failed to insert info " << id << std::endl; std::cerr << "Failed to insert info " << id << std::endl;
} }
void Dialogue::clearDeletedInfos() void Dialogue::clearDeletedInfos()
{ {
for (InfoContainer::iterator it = mInfo.begin(); it != mInfo.end(); ) for (InfoContainer::iterator it = mInfo.begin(); it != mInfo.end(); )
{ {
if (it->mQuestStatus == DialInfo::QS_Deleted) if (it->mQuestStatus == DialInfo::QS_Deleted)
@ -132,6 +136,5 @@ void Dialogue::clearDeletedInfos()
else else
++it; ++it;
} }
} }
} }

@ -47,6 +47,8 @@ struct Dialogue
bool mIsDeleted; bool mIsDeleted;
Dialogue();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Door::sRecordId = REC_DOOR; unsigned int Door::sRecordId = REC_DOOR;
Door::Door()
: mIsDeleted(false)
{}
void Door::load(ESMReader &esm) void Door::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -19,6 +19,8 @@ struct Door
bool mIsDeleted; bool mIsDeleted;
Door();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,8 +9,12 @@ namespace ESM
{ {
unsigned int Enchantment::sRecordId = REC_ENCH; unsigned int Enchantment::sRecordId = REC_ENCH;
void Enchantment::load(ESMReader &esm) Enchantment::Enchantment()
{ : mIsDeleted(false)
{}
void Enchantment::load(ESMReader &esm)
{
mEffects.mList.clear(); mEffects.mList.clear();
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");
@ -40,10 +44,10 @@ void Enchantment::load(ESMReader &esm)
} }
if (!hasData) if (!hasData)
esm.fail("Missing ENDT subrecord"); esm.fail("Missing ENDT subrecord");
} }
void Enchantment::save(ESMWriter &esm) const void Enchantment::save(ESMWriter &esm) const
{ {
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);
if (mIsDeleted) if (mIsDeleted)
{ {
@ -53,7 +57,7 @@ void Enchantment::save(ESMWriter &esm) const
esm.writeHNT("ENDT", mData, 16); esm.writeHNT("ENDT", mData, 16);
mEffects.save(esm); mEffects.save(esm);
} }
void Enchantment::blank() void Enchantment::blank()
{ {

@ -44,6 +44,8 @@ struct Enchantment
bool mIsDeleted; bool mIsDeleted;
Enchantment();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -11,6 +11,10 @@ namespace ESM
{ {
unsigned int Faction::sRecordId = REC_FACT; unsigned int Faction::sRecordId = REC_FACT;
Faction::Faction()
: mIsDeleted(false)
{}
int& Faction::FADTstruct::getSkill (int index, bool ignored) int& Faction::FADTstruct::getSkill (int index, bool ignored)
{ {
if (index<0 || index>=7) if (index<0 || index>=7)
@ -27,8 +31,8 @@ namespace ESM
return mSkills[index]; return mSkills[index];
} }
void Faction::load(ESMReader &esm) void Faction::load(ESMReader &esm)
{ {
mReactions.clear(); mReactions.clear();
for (int i=0;i<10;++i) for (int i=0;i<10;++i)
mRanks[i].clear(); mRanks[i].clear();
@ -75,9 +79,10 @@ void Faction::load(ESMReader &esm)
} }
if (!hasData) if (!hasData)
esm.fail("Missing FADT subrecord"); esm.fail("Missing FADT subrecord");
} }
void Faction::save(ESMWriter &esm) const
{ void Faction::save(ESMWriter &esm) const
{
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);
if (mIsDeleted) if (mIsDeleted)
{ {
@ -102,7 +107,7 @@ void Faction::save(ESMWriter &esm) const
esm.writeHNString("ANAM", it->first); esm.writeHNString("ANAM", it->first);
esm.writeHNT("INTV", it->second); esm.writeHNT("INTV", it->second);
} }
} }
void Faction::blank() void Faction::blank()
{ {

@ -64,6 +64,8 @@ struct Faction
bool mIsDeleted; bool mIsDeleted;
Faction();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Global::sRecordId = REC_GLOB; unsigned int Global::sRecordId = REC_GLOB;
Global::Global()
: mIsDeleted(false)
{}
void Global::load (ESMReader &esm) void Global::load (ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -26,6 +26,8 @@ struct Global
bool mIsDeleted; bool mIsDeleted;
Global();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,8 +9,12 @@ namespace ESM
{ {
unsigned int DialInfo::sRecordId = REC_INFO; unsigned int DialInfo::sRecordId = REC_INFO;
void DialInfo::load(ESMReader &esm) DialInfo::DialInfo()
{ : mIsDeleted(false)
{}
void DialInfo::load(ESMReader &esm)
{
mQuestStatus = QS_None; mQuestStatus = QS_None;
mFactionLess = false; mFactionLess = false;
@ -132,10 +136,10 @@ void DialInfo::load(ESMReader &esm)
if (mQuestStatus != QS_None) if (mQuestStatus != QS_None)
// Skip rest of record // Skip rest of record
esm.skipRecord(); esm.skipRecord();
} }
void DialInfo::save(ESMWriter &esm) const void DialInfo::save(ESMWriter &esm) const
{ {
esm.writeHNCString("PNAM", mPrev); esm.writeHNCString("PNAM", mPrev);
esm.writeHNCString("NNAM", mNext); esm.writeHNCString("NNAM", mNext);
if (mIsDeleted) if (mIsDeleted)
@ -171,7 +175,7 @@ void DialInfo::save(ESMWriter &esm) const
case QS_Deleted: esm.writeHNT("DELE", '\1'); break; case QS_Deleted: esm.writeHNT("DELE", '\1'); break;
default: break; default: break;
} }
} }
void DialInfo::blank() void DialInfo::blank()
{ {

@ -108,6 +108,8 @@ struct DialInfo
bool mIsDeleted; bool mIsDeleted;
DialInfo();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Ingredient::sRecordId = REC_INGR; unsigned int Ingredient::sRecordId = REC_INGR;
Ingredient::Ingredient()
: mIsDeleted(false)
{}
void Ingredient::load(ESMReader &esm) void Ingredient::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -33,6 +33,8 @@ struct Ingredient
bool mIsDeleted; bool mIsDeleted;
Ingredient();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -7,6 +7,9 @@
namespace ESM namespace ESM
{ {
LevelledListBase::LevelledListBase()
: mIsDeleted(false)
{}
void LevelledListBase::load(ESMReader &esm) void LevelledListBase::load(ESMReader &esm)
{ {

@ -38,6 +38,8 @@ struct LevelledListBase
bool mIsDeleted; bool mIsDeleted;
LevelledListBase();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Light::sRecordId = REC_LIGH; unsigned int Light::sRecordId = REC_LIGH;
Light::Light()
: mIsDeleted(false)
{}
void Light::load(ESMReader &esm) void Light::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -49,6 +49,8 @@ struct Light
bool mIsDeleted; bool mIsDeleted;
Light();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Lockpick::sRecordId = REC_LOCK; unsigned int Lockpick::sRecordId = REC_LOCK;
Lockpick::Lockpick()
: mIsDeleted(false)
{}
void Lockpick::load(ESMReader &esm) void Lockpick::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -29,6 +29,8 @@ struct Lockpick
bool mIsDeleted; bool mIsDeleted;
Lockpick();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,15 +9,19 @@ namespace ESM
{ {
unsigned int LandTexture::sRecordId = REC_LTEX; unsigned int LandTexture::sRecordId = REC_LTEX;
void LandTexture::load(ESMReader &esm) LandTexture::LandTexture()
{ : mIsDeleted(false)
{}
void LandTexture::load(ESMReader &esm)
{
mIsDeleted = readDeleSubRecord(esm); mIsDeleted = readDeleSubRecord(esm);
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");
esm.getHNT(mIndex, "INTV"); esm.getHNT(mIndex, "INTV");
mTexture = esm.getHNString("DATA"); mTexture = esm.getHNString("DATA");
} }
void LandTexture::save(ESMWriter &esm) const void LandTexture::save(ESMWriter &esm) const
{ {
if (mIsDeleted) if (mIsDeleted)
{ {
writeDeleSubRecord(esm); writeDeleSubRecord(esm);
@ -25,13 +29,12 @@ void LandTexture::save(ESMWriter &esm) const
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);
esm.writeHNT("INTV", mIndex); esm.writeHNT("INTV", mIndex);
esm.writeHNCString("DATA", mTexture); esm.writeHNCString("DATA", mTexture);
} }
void LandTexture::blank() void LandTexture::blank()
{ {
mTexture.clear(); mTexture.clear();
mIndex = -1; mIndex = -1;
mIsDeleted = false; mIsDeleted = false;
} }
} }

@ -36,11 +36,13 @@ struct LandTexture
bool mIsDeleted; bool mIsDeleted;
void blank(); LandTexture();
///< Set record to default state (does not touch the ID).
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;
void blank();
///< Set record to default state (does not touch the ID).
}; };
} }
#endif #endif

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Miscellaneous::sRecordId = REC_MISC; unsigned int Miscellaneous::sRecordId = REC_MISC;
Miscellaneous::Miscellaneous()
: mIsDeleted(false)
{}
void Miscellaneous::load(ESMReader &esm) void Miscellaneous::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -34,6 +34,8 @@ struct Miscellaneous
bool mIsDeleted; bool mIsDeleted;
Miscellaneous();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int NPC::sRecordId = REC_NPC_; unsigned int NPC::sRecordId = REC_NPC_;
NPC::NPC()
: mIsDeleted(false)
{}
void NPC::load(ESMReader &esm) void NPC::load(ESMReader &esm)
{ {
mPersistent = (esm.getRecordFlags() & 0x0400) != 0; mPersistent = (esm.getRecordFlags() & 0x0400) != 0;

@ -132,6 +132,8 @@ struct NPC
bool mIsDeleted; bool mIsDeleted;
NPC();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Probe::sRecordId = REC_PROB; unsigned int Probe::sRecordId = REC_PROB;
Probe::Probe()
: mIsDeleted(false)
{}
void Probe::load(ESMReader &esm) void Probe::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -29,6 +29,8 @@ struct Probe
bool mIsDeleted; bool mIsDeleted;
Probe();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,8 +9,12 @@ namespace ESM
{ {
unsigned int Region::sRecordId = REC_REGN; unsigned int Region::sRecordId = REC_REGN;
void Region::load(ESMReader &esm) Region::Region()
{ : mIsDeleted(false)
{}
void Region::load(ESMReader &esm)
{
mIsDeleted = readDeleSubRecord(esm); mIsDeleted = readDeleSubRecord(esm);
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");
mName = esm.getHNOString("FNAM"); mName = esm.getHNOString("FNAM");
@ -49,9 +53,10 @@ void Region::load(ESMReader &esm)
esm.getHNT(sr, "SNAM", 33); esm.getHNT(sr, "SNAM", 33);
mSoundList.push_back(sr); mSoundList.push_back(sr);
} }
} }
void Region::save(ESMWriter &esm) const
{ void Region::save(ESMWriter &esm) const
{
if (mIsDeleted) if (mIsDeleted)
{ {
writeDeleSubRecord(esm); writeDeleSubRecord(esm);
@ -71,7 +76,7 @@ void Region::save(ESMWriter &esm) const
{ {
esm.writeHNT<SoundRef>("SNAM", *it); esm.writeHNT<SoundRef>("SNAM", *it);
} }
} }
void Region::blank() void Region::blank()
{ {

@ -53,6 +53,8 @@ struct Region
bool mIsDeleted; bool mIsDeleted;
Region();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,8 +9,12 @@ namespace ESM
{ {
unsigned int Repair::sRecordId = REC_REPA; unsigned int Repair::sRecordId = REC_REPA;
void Repair::load(ESMReader &esm) Repair::Repair()
{ : mIsDeleted(false)
{}
void Repair::load(ESMReader &esm)
{
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");
if (mIsDeleted = readDeleSubRecord(esm)) if (mIsDeleted = readDeleSubRecord(esm))
{ {
@ -46,10 +50,10 @@ void Repair::load(ESMReader &esm)
} }
if (!hasData) if (!hasData)
esm.fail("Missing RIDT subrecord"); esm.fail("Missing RIDT subrecord");
} }
void Repair::save(ESMWriter &esm) const void Repair::save(ESMWriter &esm) const
{ {
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);
if (mIsDeleted) if (mIsDeleted)
{ {
@ -63,7 +67,7 @@ void Repair::save(ESMWriter &esm) const
esm.writeHNT("RIDT", mData, 16); esm.writeHNT("RIDT", mData, 16);
esm.writeHNOString("SCRI", mScript); esm.writeHNOString("SCRI", mScript);
esm.writeHNOCString("ITEX", mIcon); esm.writeHNOCString("ITEX", mIcon);
} }
void Repair::blank() void Repair::blank()
{ {

@ -29,6 +29,8 @@ struct Repair
bool mIsDeleted; bool mIsDeleted;
Repair();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,9 +9,12 @@
namespace ESM namespace ESM
{ {
unsigned int Script::sRecordId = REC_SCPT; unsigned int Script::sRecordId = REC_SCPT;
Script::Script()
: mIsDeleted(false)
{}
void Script::loadSCVR(ESMReader &esm) void Script::loadSCVR(ESMReader &esm)
{ {
int s = mData.mStringTableSize; int s = mData.mStringTableSize;

@ -52,6 +52,8 @@ public:
bool mIsDeleted; bool mIsDeleted;
Script();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int SoundGenerator::sRecordId = REC_SNDG; unsigned int SoundGenerator::sRecordId = REC_SNDG;
SoundGenerator::SoundGenerator()
: mIsDeleted(false)
{}
void SoundGenerator::load(ESMReader &esm) void SoundGenerator::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -38,6 +38,8 @@ struct SoundGenerator
bool mIsDeleted; bool mIsDeleted;
SoundGenerator();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Sound::sRecordId = REC_SOUN; unsigned int Sound::sRecordId = REC_SOUN;
Sound::Sound()
: mIsDeleted(false)
{}
void Sound::load(ESMReader &esm) void Sound::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -25,6 +25,8 @@ struct Sound
bool mIsDeleted; bool mIsDeleted;
Sound();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Spell::sRecordId = REC_SPEL; unsigned int Spell::sRecordId = REC_SPEL;
Spell::Spell()
: mIsDeleted(false)
{}
void Spell::load(ESMReader &esm) void Spell::load(ESMReader &esm)
{ {
mEffects.mList.clear(); mEffects.mList.clear();

@ -47,6 +47,8 @@ struct Spell
bool mIsDeleted; bool mIsDeleted;
Spell();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Static::sRecordId = REC_STAT; unsigned int Static::sRecordId = REC_STAT;
Static::Static()
: mIsDeleted(false)
{}
void Static::load(ESMReader &esm) void Static::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -30,6 +30,8 @@ struct Static
bool mIsDeleted; bool mIsDeleted;
Static();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

@ -9,6 +9,10 @@ namespace ESM
{ {
unsigned int Weapon::sRecordId = REC_WEAP; unsigned int Weapon::sRecordId = REC_WEAP;
Weapon::Weapon()
: mIsDeleted(false)
{}
void Weapon::load(ESMReader &esm) void Weapon::load(ESMReader &esm)
{ {
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");

@ -71,6 +71,8 @@ struct Weapon
bool mIsDeleted; bool mIsDeleted;
Weapon();
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;

Loading…
Cancel
Save