mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-31 15:32:45 +00:00
added blank function to all referencable record structs
This commit is contained in:
parent
13e7abd7df
commit
b21dae8d75
@ -5,6 +5,12 @@
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
void AIData::blank()
|
||||
{
|
||||
mHello = mU1 = mFight = mFlee = mAlarm = mU2 = mU3 = mU4 = 0;
|
||||
mServices = 0;
|
||||
}
|
||||
|
||||
void AIPackageList::load(ESMReader &esm)
|
||||
{
|
||||
while (esm.hasMoreSubs()) {
|
||||
|
@ -19,6 +19,9 @@ namespace ESM
|
||||
// These are probabilities
|
||||
char mHello, mU1, mFight, mFlee, mAlarm, mU2, mU3, mU4;
|
||||
int mServices; // See the Services enum
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
}; // 12 bytes
|
||||
|
||||
struct AIWander
|
||||
|
@ -17,4 +17,11 @@ void Activator::save(ESMWriter &esm)
|
||||
esm.writeHNCString("FNAM", mName);
|
||||
esm.writeHNOCString("SCRI", mScript);
|
||||
}
|
||||
|
||||
void Activator::blank()
|
||||
{
|
||||
mName.clear();
|
||||
mScript.clear();
|
||||
mModel.clear();
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ struct Activator
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -23,4 +23,16 @@ void Potion::save(ESMWriter &esm)
|
||||
esm.writeHNT("ALDT", mData, 12);
|
||||
mEffects.save(esm);
|
||||
}
|
||||
|
||||
void Potion::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mAutoCalc = 0;
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
mEffects.mList.clear();
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ struct Potion
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -36,4 +36,16 @@ void Apparatus::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("SCRI", mScript);
|
||||
esm.writeHNCString("ITEX", mIcon);
|
||||
}
|
||||
|
||||
void Apparatus::blank()
|
||||
{
|
||||
mData.mType = 0;
|
||||
mData.mQuality = 0;
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
mName.clear();
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ struct Apparatus
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -50,4 +50,19 @@ void Armor::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("ENAM", mEnchant);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,9 @@ struct Armor
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -27,4 +27,18 @@ void Book::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("ENAM", mEnchant);
|
||||
}
|
||||
|
||||
void Book::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mIsScroll = 0;
|
||||
mData.mSkillID = 0;
|
||||
mData.mEnchant = 0;
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
mEnchant.clear();
|
||||
mText.clear();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ struct Book
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -16,7 +16,7 @@ void Clothing::load(ESMReader &esm)
|
||||
mIcon = esm.getHNOString("ITEX");
|
||||
|
||||
mParts.load(esm);
|
||||
|
||||
|
||||
|
||||
mEnchant = esm.getHNOString("ENAM");
|
||||
}
|
||||
@ -28,10 +28,24 @@ void Clothing::save(ESMWriter &esm)
|
||||
|
||||
esm.writeHNOCString("SCRI", mScript);
|
||||
esm.writeHNOCString("ITEX", mIcon);
|
||||
|
||||
|
||||
mParts.save(esm);
|
||||
|
||||
|
||||
esm.writeHNOCString("ENAM", mEnchant);
|
||||
}
|
||||
|
||||
void Clothing::blank()
|
||||
{
|
||||
mData.mType = 0;
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mEnchant = 0;
|
||||
mParts.mParts.clear();
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mIcon.clear();
|
||||
mEnchant.clear();
|
||||
mScript.clear();
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,9 @@ struct Clothing
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -53,4 +53,13 @@ void Container::save(ESMWriter &esm)
|
||||
mInventory.save(esm);
|
||||
}
|
||||
|
||||
void Container::blank()
|
||||
{
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mScript.clear();
|
||||
mWeight = 0;
|
||||
mFlags = 0;
|
||||
mInventory.mList.clear();
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,9 @@ struct Container
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -53,4 +53,28 @@ void Creature::save(ESMWriter &esm)
|
||||
mAiPackage.save(esm);
|
||||
}
|
||||
|
||||
void Creature::blank()
|
||||
{
|
||||
mData.mType = 0;
|
||||
mData.mLevel = 0;
|
||||
mData.mStrength = mData.mIntelligence = mData.mWillpower = mData.mAgility =
|
||||
mData.mSpeed = mData.mEndurance = mData.mPersonality = mData.mLuck = 0;
|
||||
mData.mHealth = mData.mMana = mData.mFatigue = 0;
|
||||
mData.mSoul = 0;
|
||||
mData.mCombat = mData.mMagic = mData.mStealth = 0;
|
||||
for (int i=0; i<6; ++i) mData.mAttack[i] = 0;
|
||||
mData.mGold = 0;
|
||||
mFlags = 0;
|
||||
mScale = 0;
|
||||
mModel.clear();
|
||||
mName.clear();
|
||||
mScript.clear();
|
||||
mOriginal.clear();
|
||||
mInventory.mList.clear();
|
||||
mSpells.mList.clear();
|
||||
mHasAI = false;
|
||||
mAiData.blank();
|
||||
mAiData.mServices = 0;
|
||||
mAiPackage.mList.clear();
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,9 @@ struct Creature
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -24,4 +24,12 @@ void Door::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("ANAM", mCloseSound);
|
||||
}
|
||||
|
||||
void Door::blank()
|
||||
{
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mScript.clear();
|
||||
mOpenSound.clear();
|
||||
mCloseSound.clear();
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ struct Door
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@ void Ingredient::load(ESMReader &esm)
|
||||
{
|
||||
mData.mAttributes[i] = -1;
|
||||
}
|
||||
|
||||
|
||||
// is this relevant in cycle from 0 to 4?
|
||||
if (mData.mEffectID[i] != 89 &&
|
||||
mData.mEffectID[i] != 26 &&
|
||||
@ -46,4 +46,20 @@ void Ingredient::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("ITEX", mIcon);
|
||||
}
|
||||
|
||||
void Ingredient::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
for (int i=0; i<4; ++i)
|
||||
{
|
||||
mData.mEffectID[i] = 0;
|
||||
mData.mSkills[i] = 0;
|
||||
mData.mAttributes[i] = 0;
|
||||
}
|
||||
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ struct Ingredient
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@ void LeveledListBase::save(ESMWriter &esm)
|
||||
esm.writeHNT("DATA", mFlags);
|
||||
esm.writeHNT("NNAM", mChanceNone);
|
||||
esm.writeHNT<int>("INDX", mList.size());
|
||||
|
||||
|
||||
for (std::vector<LevelItem>::iterator it = mList.begin(); it != mList.end(); ++it)
|
||||
{
|
||||
esm.writeHNCString(mRecName, it->mId);
|
||||
@ -46,4 +46,10 @@ void LeveledListBase::save(ESMWriter &esm)
|
||||
}
|
||||
}
|
||||
|
||||
void LeveledListBase::blank()
|
||||
{
|
||||
mFlags = 0;
|
||||
mChanceNone = 0;
|
||||
mList.clear();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class ESMWriter;
|
||||
* to implement it once.
|
||||
*
|
||||
* We should later implement the ability to merge leveled lists from
|
||||
* several files.
|
||||
* several files.
|
||||
*/
|
||||
|
||||
struct LeveledListBase
|
||||
@ -52,6 +52,9 @@ struct LeveledListBase
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
|
||||
struct CreatureLevList: LeveledListBase
|
||||
|
@ -26,4 +26,18 @@ void Light::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("SNAM", mSound);
|
||||
}
|
||||
|
||||
void Light::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mTime = 0;
|
||||
mData.mRadius = 0;
|
||||
mData.mColor = 0;
|
||||
mData.mFlags = 0;
|
||||
mSound.clear();
|
||||
mScript.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mName.clear();
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,9 @@ struct Light
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -21,11 +21,21 @@ void Lockpick::save(ESMWriter &esm)
|
||||
{
|
||||
esm.writeHNCString("MODL", mModel);
|
||||
esm.writeHNCString("FNAM", mName);
|
||||
|
||||
|
||||
esm.writeHNT("LKDT", mData, 16);
|
||||
esm.writeHNOString("SCRI", mScript);
|
||||
esm.writeHNOCString("ITEX", mIcon);
|
||||
}
|
||||
|
||||
|
||||
void Lockpick::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mQuality = 0;
|
||||
mData.mUses = 0;
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ struct Lockpick
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -23,4 +23,14 @@ void Miscellaneous::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("ITEX", mIcon);
|
||||
}
|
||||
|
||||
void Miscellaneous::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mIsKey = 0;
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,9 @@ struct Miscellaneous
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -56,7 +56,7 @@ void NPC::load(ESMReader &esm)
|
||||
mTransport.push_back(dodt);
|
||||
} else if (esm.retSubName() == 0x4d414e44) { // DNAM struct
|
||||
mTransport.back().mCellName = esm.getHString();
|
||||
}
|
||||
}
|
||||
}
|
||||
mAiPackage.load(esm);
|
||||
esm.skipRecord();
|
||||
@ -71,14 +71,14 @@ void NPC::save(ESMWriter &esm)
|
||||
esm.writeHNCString("BNAM", mHead);
|
||||
esm.writeHNCString("KNAM", mHair);
|
||||
esm.writeHNOCString("SCRI", mScript);
|
||||
|
||||
|
||||
if (mNpdtType == 52)
|
||||
esm.writeHNT("NPDT", mNpdt52, 52);
|
||||
else if (mNpdtType == 12)
|
||||
esm.writeHNT("NPDT", mNpdt12, 12);
|
||||
|
||||
esm.writeHNT("FLAG", mFlags);
|
||||
|
||||
|
||||
mInventory.save(esm);
|
||||
mSpells.save(esm);
|
||||
if (mHasAI) {
|
||||
@ -93,4 +93,53 @@ void NPC::save(ESMWriter &esm)
|
||||
mAiPackage.save(esm);
|
||||
}
|
||||
|
||||
bool NPC::isMale() const {
|
||||
return (mFlags & Female) == 0;
|
||||
}
|
||||
|
||||
void NPC::setIsMale(bool value) {
|
||||
mFlags |= Female;
|
||||
if (value) {
|
||||
mFlags ^= Female;
|
||||
}
|
||||
}
|
||||
|
||||
void NPC::blank()
|
||||
{
|
||||
mNpdtType = 0;
|
||||
mNpdt52.mLevel = 0;
|
||||
mNpdt52.mStrength = mNpdt52.mIntelligence = mNpdt52.mWillpower = mNpdt52.mAgility =
|
||||
mNpdt52.mSpeed = mNpdt52.mEndurance = mNpdt52.mPersonality = mNpdt52.mLuck = 0;
|
||||
for (int i=0; i<27; ++i) mNpdt52.mSkills[i] = 0;
|
||||
mNpdt52.mReputation = 0;
|
||||
mNpdt52.mHealth = mNpdt52.mMana = mNpdt52.mFatigue = 0;
|
||||
mNpdt52.mDisposition = 0;
|
||||
mNpdt52.mFactionID = 0;
|
||||
mNpdt52.mRank = 0;
|
||||
mNpdt52.mUnknown = 0;
|
||||
mNpdt52.mGold = 0;
|
||||
mNpdt12.mLevel = 0;
|
||||
mNpdt12.mDisposition = 0;
|
||||
mNpdt12.mReputation = 0;
|
||||
mNpdt12.mRank = 0;
|
||||
mNpdt12.mUnknown1 = 0;
|
||||
mNpdt12.mUnknown2 = 0;
|
||||
mNpdt12.mUnknown3 = 0;
|
||||
mNpdt12.mGold = 0;
|
||||
mFlags = 0;
|
||||
mInventory.mList.clear();
|
||||
mSpells.mList.clear();
|
||||
mAiData.blank();
|
||||
mHasAI = false;
|
||||
mTransport.clear();
|
||||
mAiPackage.mList.clear();
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mRace.clear();
|
||||
mClass.clear();
|
||||
mFaction.clear();
|
||||
mScript.clear();
|
||||
mHair.clear();
|
||||
mHead.clear();
|
||||
}
|
||||
}
|
||||
|
@ -114,20 +114,15 @@ struct NPC
|
||||
// body parts
|
||||
std::string mHair, mHead;
|
||||
|
||||
// Implementation moved to load_impl.cpp
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
bool isMale() const {
|
||||
return (mFlags & Female) == 0;
|
||||
}
|
||||
bool isMale() const;
|
||||
|
||||
void setIsMale(bool value) {
|
||||
mFlags |= Female;
|
||||
if (value) {
|
||||
mFlags ^= Female;
|
||||
}
|
||||
}
|
||||
void setIsMale(bool value);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -21,10 +21,21 @@ void Probe::save(ESMWriter &esm)
|
||||
{
|
||||
esm.writeHNCString("MODL", mModel);
|
||||
esm.writeHNCString("FNAM", mName);
|
||||
|
||||
|
||||
esm.writeHNT("PBDT", mData, 16);
|
||||
esm.writeHNOString("SCRI", mScript);
|
||||
esm.writeHNOCString("ITEX", mIcon);
|
||||
}
|
||||
|
||||
void Probe::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mQuality = 0;
|
||||
mData.mUses = 0;
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ struct Probe
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -27,5 +27,15 @@ void Repair::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("ITEX", mIcon);
|
||||
}
|
||||
|
||||
|
||||
void Repair::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mQuality = 0;
|
||||
mData.mUses = 0;
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mScript.clear();
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,9 @@ struct Repair
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -15,4 +15,8 @@ void Static::save(ESMWriter &esm)
|
||||
esm.writeHNCString("MODL", mModel);
|
||||
}
|
||||
|
||||
void Static::blank()
|
||||
{
|
||||
mModel.clear();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ struct Static
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
@ -25,4 +25,24 @@ void Weapon::save(ESMWriter &esm)
|
||||
esm.writeHNOCString("ENAM", mEnchant);
|
||||
}
|
||||
|
||||
void Weapon::blank()
|
||||
{
|
||||
mData.mWeight = 0;
|
||||
mData.mValue = 0;
|
||||
mData.mType = 0;
|
||||
mData.mHealth = 0;
|
||||
mData.mSpeed = 0;
|
||||
mData.mReach = 0;
|
||||
mData.mEnchant = 0;
|
||||
mData.mChop[0] = mData.mChop[1] = 0;
|
||||
mData.mSlash[0] = mData.mSlash[1] = 0;
|
||||
mData.mThrust[0] = mData.mThrust[1] = 0;
|
||||
mData.mFlags = 0;
|
||||
|
||||
mName.clear();
|
||||
mModel.clear();
|
||||
mIcon.clear();
|
||||
mEnchant.clear();
|
||||
mScript.clear();
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,9 @@ struct Weapon
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm);
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user