1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-01 17:45:34 +00:00
openmw/components/esm3/debugprofile.cpp

65 lines
1.5 KiB
C++
Raw Normal View History

2014-08-03 08:12:03 +00:00
#include "debugprofile.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
2022-09-22 18:26:05 +00:00
void DebugProfile::load(ESMReader& esm, bool& isDeleted)
{
2022-09-22 18:26:05 +00:00
isDeleted = false;
mRecordFlags = esm.getRecordFlags();
while (esm.hasMoreSubs())
{
2022-09-22 18:26:05 +00:00
esm.getSubName();
switch (esm.retSubName().toInt())
{
case SREC_NAME:
mId = esm.getHString();
break;
case fourCC("DESC"):
mDescription = esm.getHString();
break;
case fourCC("SCRP"):
mScriptText = esm.getHString();
break;
case fourCC("FLAG"):
esm.getHT(mFlags);
break;
case SREC_DELE:
esm.skipHSub();
isDeleted = true;
break;
default:
esm.fail("Unknown subrecord");
break;
}
}
}
2014-08-03 08:12:03 +00:00
2022-09-22 18:26:05 +00:00
void DebugProfile::save(ESMWriter& esm, bool isDeleted) const
{
2022-09-22 18:26:05 +00:00
esm.writeHNCString("NAME", mId);
2022-09-22 18:26:05 +00:00
if (isDeleted)
{
esm.writeHNString("DELE", "", 3);
return;
}
2014-08-03 08:12:03 +00:00
2022-09-22 18:26:05 +00:00
esm.writeHNCString("DESC", mDescription);
esm.writeHNCString("SCRP", mScriptText);
esm.writeHNT("FLAG", mFlags);
}
void DebugProfile::blank()
{
mDescription.clear();
mScriptText.clear();
mFlags = 0;
}
}