mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 20:45:34 +00:00
Add NAME and DELE handling to Script record
(cherry picked from commit d2c15647a3
)
This commit is contained in:
parent
44c36a00f8
commit
1b21d1b5f7
2 changed files with 14 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue