Add DELE handling to Info record

openmw-38
Stanislav Bas 10 years ago
parent 0b537186e5
commit 847614c26f

@ -3,6 +3,7 @@
#include "esmreader.hpp"
#include "esmwriter.hpp"
#include "defs.hpp"
#include "util.hpp"
namespace ESM
{
@ -19,11 +20,18 @@ void DialInfo::load(ESMReader &esm)
// Since there's no way to mark selects as "deleted", we have to clear the SelectStructs from all previous loadings
mSelects.clear();
// Not present if deleted
if (esm.isNextSub("DATA")) {
esm.getHT(mData, 12);
// If the info is deleted, NAME and DELE sub-records are followed after NNAM
if (esm.isNextSub("NAME"))
{
esm.getSubName();
mResponse = esm.getHString();
mIsDeleted = readDeleSubRecord(esm);
return;
}
esm.getSubNameIs("DATA");
esm.getHT(mData, 12);
if (!esm.hasMoreSubs())
return;
@ -131,6 +139,13 @@ void DialInfo::save(ESMWriter &esm) const
{
esm.writeHNCString("PNAM", mPrev);
esm.writeHNCString("NNAM", mNext);
if (mIsDeleted)
{
esm.writeHNCString("NAME", mResponse);
writeDeleSubRecord(esm);
return;
}
esm.writeHNT("DATA", mData, 12);
esm.writeHNOCString("ONAM", mActor);
esm.writeHNOCString("RNAM", mRace);

@ -106,6 +106,8 @@ struct DialInfo
REC_DELE = 0x454c4544
};
bool mIsDeleted;
void load(ESMReader &esm);
void save(ESMWriter &esm) const;

Loading…
Cancel
Save