1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 11:09:41 +00:00

Add DELE handling to Info record

This commit is contained in:
Stanislav Bas 2015-07-07 19:57:08 +03:00
parent 0b537186e5
commit 847614c26f
2 changed files with 20 additions and 3 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
{ {
@ -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 // Since there's no way to mark selects as "deleted", we have to clear the SelectStructs from all previous loadings
mSelects.clear(); mSelects.clear();
// Not present if deleted // If the info is deleted, NAME and DELE sub-records are followed after NNAM
if (esm.isNextSub("DATA")) { if (esm.isNextSub("NAME"))
esm.getHT(mData, 12); {
esm.getSubName();
mResponse = esm.getHString();
mIsDeleted = readDeleSubRecord(esm);
return;
} }
esm.getSubNameIs("DATA");
esm.getHT(mData, 12);
if (!esm.hasMoreSubs()) if (!esm.hasMoreSubs())
return; return;
@ -131,6 +139,13 @@ void DialInfo::save(ESMWriter &esm) const
{ {
esm.writeHNCString("PNAM", mPrev); esm.writeHNCString("PNAM", mPrev);
esm.writeHNCString("NNAM", mNext); esm.writeHNCString("NNAM", mNext);
if (mIsDeleted)
{
esm.writeHNCString("NAME", mResponse);
writeDeleSubRecord(esm);
return;
}
esm.writeHNT("DATA", mData, 12); esm.writeHNT("DATA", mData, 12);
esm.writeHNOCString("ONAM", mActor); esm.writeHNOCString("ONAM", mActor);
esm.writeHNOCString("RNAM", mRace); esm.writeHNOCString("RNAM", mRace);

View file

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