1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 21:32:42 +00:00

Add NAME and DELE handling to Script record

(cherry picked from commit d2c15647a3f1a03ad3c34dd7eaf6fe6cfbcd35ab)
This commit is contained in:
Stanislav Bas 2015-07-07 17:00:40 +03:00 committed by cc9cii
parent 44c36a00f8
commit 1b21d1b5f7
2 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
#include "defs.hpp" #include "defs.hpp"
#include "util.hpp"
namespace ESM namespace ESM
{ {
@ -63,6 +64,10 @@ namespace ESM
mData = data.mData; mData = data.mData;
mId = data.mName.toString(); 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(); mVarNames.clear();
while (esm.hasMoreSubs()) while (esm.hasMoreSubs())
@ -109,6 +114,11 @@ namespace ESM
esm.writeHNT("SCHD", data, 52); esm.writeHNT("SCHD", data, 52);
if (mIsDeleted)
{
writeDeleSubRecord(esm);
}
if (!mVarNames.empty()) if (!mVarNames.empty())
{ {
esm.startSubRecord("SCVR"); esm.startSubRecord("SCVR");
@ -139,6 +149,8 @@ namespace ESM
mScriptText = "Begin \"" + mId + "\"\n\nEnd " + mId + "\n"; mScriptText = "Begin \"" + mId + "\"\n\nEnd " + mId + "\n";
else else
mScriptText = "Begin " + mId + "\n\nEnd " + mId + "\n"; mScriptText = "Begin " + mId + "\n\nEnd " + mId + "\n";
mIsDeleted = false;
} }
} }

View File

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