Add NAME and DELE handling to Script record

openmw-38
Stanislav Bas 10 years ago
parent 9ac20a3355
commit d2c15647a3

@ -3,6 +3,7 @@
#include "esmreader.hpp"
#include "esmwriter.hpp"
#include "defs.hpp"
#include "util.hpp"
#include <iostream>
@ -65,6 +66,10 @@ namespace ESM
mData = data.mData;
mId = data.mName.toString();
// In scripts DELE sub-record appears after a header.
// The script data is following after DELE in this case.
mIsDeleted = readDeleSubRecord(esm);
mVarNames.clear();
while (esm.hasMoreSubs())
@ -106,6 +111,11 @@ namespace ESM
esm.writeHNT("SCHD", data, 52);
if (mIsDeleted)
{
writeDeleSubRecord(esm);
}
if (!mVarNames.empty())
{
esm.startSubRecord("SCVR");
@ -136,6 +146,8 @@ namespace ESM
mScriptText = "Begin \"" + mId + "\"\n\nEnd " + mId + "\n";
else
mScriptText = "Begin " + mId + "\n\nEnd " + mId + "\n";
mIsDeleted = false;
}
}

@ -50,6 +50,8 @@ public:
/// Script source code
std::string mScriptText;
bool mIsDeleted;
void load(ESMReader &esm);
void save(ESMWriter &esm) const;

Loading…
Cancel
Save