mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 03:32:36 +00:00
Add NAME and DELE handling to Script record
(cherry picked from commit d2c15647a3f1a03ad3c34dd7eaf6fe6cfbcd35ab)
This commit is contained in:
parent
44c36a00f8
commit
1b21d1b5f7
@ -3,6 +3,7 @@
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "defs.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
@ -63,6 +64,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())
|
||||
@ -109,6 +114,11 @@ namespace ESM
|
||||
|
||||
esm.writeHNT("SCHD", data, 52);
|
||||
|
||||
if (mIsDeleted)
|
||||
{
|
||||
writeDeleSubRecord(esm);
|
||||
}
|
||||
|
||||
if (!mVarNames.empty())
|
||||
{
|
||||
esm.startSubRecord("SCVR");
|
||||
@ -139,6 +149,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…
x
Reference in New Issue
Block a user