include targeted script data in saved games

deque
Marc Zinnschlag 11 years ago
parent 8241ee59c3
commit e9377ad5c4

@ -113,6 +113,8 @@ namespace MWScript
script.mRunning = iter->second.mRunning ? 1 : 0;
script.mTargetId = iter->second.mId;
writer.startRecord (ESM::REC_GSCR);
script.save (writer);
writer.endRecord (ESM::REC_GSCR);
@ -145,6 +147,7 @@ namespace MWScript
iter->second.mRunning = script.mRunning!=0;
iter->second.mLocals.read (script.mLocals, script.mId);
iter->second.mId = script.mTargetId;
return true;
}

@ -12,6 +12,8 @@ void ESM::GlobalScript::load (ESMReader &esm)
mRunning = 0;
esm.getHNOT (mRunning, "RUN_");
mTargetId = esm.getHNOString ("TARG");
}
void ESM::GlobalScript::save (ESMWriter &esm) const
@ -22,4 +24,6 @@ void ESM::GlobalScript::save (ESMWriter &esm) const
if (mRunning)
esm.writeHNT ("RUN_", mRunning);
esm.writeHNOString ("TARG", mTargetId);
}

@ -15,6 +15,7 @@ namespace ESM
std::string mId;
Locals mLocals;
int mRunning;
std::string mTargetId; // for targeted scripts
void load (ESMReader &esm);
void save (ESMWriter &esm) const;

Loading…
Cancel
Save