forked from OpenMW/openmw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebugprofile.cpp
61 lines (53 loc) · 1.44 KB
/
debugprofile.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "debugprofile.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
#include "defs.hpp"
unsigned int ESM::DebugProfile::sRecordId = REC_DBGP;
void ESM::DebugProfile::load (ESMReader& esm, bool &isDeleted)
{
isDeleted = false;
while (esm.hasMoreSubs())
{
esm.getSubName();
switch (esm.retSubName().val)
{
case ESM::SREC_NAME:
mId = esm.getHString();
break;
case ESM::FourCC<'D','E','S','C'>::value:
mDescription = esm.getHString();
break;
case ESM::FourCC<'S','C','R','P'>::value:
mScriptText = esm.getHString();
break;
case ESM::FourCC<'F','L','A','G'>::value:
esm.getHT(mFlags);
break;
case ESM::SREC_DELE:
esm.skipHSub();
isDeleted = true;
break;
default:
esm.fail("Unknown subrecord");
break;
}
}
}
void ESM::DebugProfile::save (ESMWriter& esm, bool isDeleted) const
{
esm.writeHNCString ("NAME", mId);
if (isDeleted)
{
esm.writeHNCString("DELE", "");
return;
}
esm.writeHNCString ("DESC", mDescription);
esm.writeHNCString ("SCRP", mScriptText);
esm.writeHNT ("FLAG", mFlags);
}
void ESM::DebugProfile::blank()
{
mDescription.clear();
mScriptText.clear();
mFlags = 0;
}