mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 08:19:56 +00:00
Add NAME and DELE handling to ESM records.
Changed records are those where DELE is inserted at the beginning of a
record (before NAME).
The record has all required sub-records in this case.
(cherry picked from commit 9ac20a3355
)
This commit is contained in:
parent
e9a8eac6af
commit
44c36a00f8
6 changed files with 36 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "defs.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -11,6 +12,10 @@ namespace ESM
|
|||
void BirthSign::load(ESMReader &esm)
|
||||
{
|
||||
mPowers.mList.clear();
|
||||
|
||||
mIsDeleted = readDeleSubRecord(esm);
|
||||
mId = esm.getHNString("NAME");
|
||||
|
||||
while (esm.hasMoreSubs())
|
||||
{
|
||||
esm.getSubName();
|
||||
|
@ -37,6 +42,11 @@ void BirthSign::load(ESMReader &esm)
|
|||
|
||||
void BirthSign::save(ESMWriter &esm) const
|
||||
{
|
||||
if (mIsDeleted)
|
||||
{
|
||||
writeDeleSubRecord(esm);
|
||||
}
|
||||
esm.writeHNCString("NAME", mId);
|
||||
esm.writeHNOCString("FNAM", mName);
|
||||
esm.writeHNOCString("TNAM", mTexture);
|
||||
esm.writeHNOCString("DESC", mDescription);
|
||||
|
@ -50,6 +60,7 @@ void BirthSign::save(ESMWriter &esm) const
|
|||
mDescription.clear();
|
||||
mTexture.clear();
|
||||
mPowers.mList.clear();
|
||||
mIsDeleted = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ struct BirthSign
|
|||
// List of powers and abilities that come with this birth sign.
|
||||
SpellList mPowers;
|
||||
|
||||
bool mIsDeleted;
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm) const;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "defs.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -10,11 +11,18 @@ namespace ESM
|
|||
|
||||
void LandTexture::load(ESMReader &esm)
|
||||
{
|
||||
mIsDeleted = readDeleSubRecord(esm);
|
||||
mId = esm.getHNString("NAME");
|
||||
esm.getHNT(mIndex, "INTV");
|
||||
mTexture = esm.getHNString("DATA");
|
||||
}
|
||||
void LandTexture::save(ESMWriter &esm) const
|
||||
{
|
||||
if (mIsDeleted)
|
||||
{
|
||||
writeDeleSubRecord(esm);
|
||||
}
|
||||
esm.writeHNCString("NAME", mId);
|
||||
esm.writeHNT("INTV", mIndex);
|
||||
esm.writeHNCString("DATA", mTexture);
|
||||
}
|
||||
|
@ -23,6 +31,7 @@ void LandTexture::blank()
|
|||
{
|
||||
mTexture.clear();
|
||||
mIndex = -1;
|
||||
mIsDeleted = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ struct LandTexture
|
|||
std::string mId, mTexture;
|
||||
int mIndex;
|
||||
|
||||
bool mIsDeleted;
|
||||
|
||||
void blank();
|
||||
///< Set record to default state (does not touch the ID).
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "defs.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -10,6 +11,8 @@ namespace ESM
|
|||
|
||||
void Region::load(ESMReader &esm)
|
||||
{
|
||||
mIsDeleted = readDeleSubRecord(esm);
|
||||
mId = esm.getHNString("NAME");
|
||||
mName = esm.getHNOString("FNAM");
|
||||
|
||||
esm.getSubNameIs("WEAT");
|
||||
|
@ -49,6 +52,11 @@ void Region::load(ESMReader &esm)
|
|||
}
|
||||
void Region::save(ESMWriter &esm) const
|
||||
{
|
||||
if (mIsDeleted)
|
||||
{
|
||||
writeDeleSubRecord(esm);
|
||||
}
|
||||
esm.writeHNString("NAME", mId);
|
||||
esm.writeHNOCString("FNAM", mName);
|
||||
|
||||
if (esm.getVersion() == VER_12)
|
||||
|
@ -77,5 +85,7 @@ void Region::save(ESMWriter &esm) const
|
|||
mName.clear();
|
||||
mSleepList.clear();
|
||||
mSoundList.clear();
|
||||
|
||||
mIsDeleted = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ struct Region
|
|||
|
||||
std::vector<SoundRef> mSoundList;
|
||||
|
||||
bool mIsDeleted;
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue