1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:59:54 +00:00
openmw/components/esm3/quickkeys.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
984 B
C++
Raw Normal View History

2014-05-02 10:47:28 +00:00
#include "quickkeys.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void QuickKeys::load(ESMReader& esm)
{
2014-05-12 19:04:02 +00:00
if (esm.isNextSub("KEY_"))
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
while (esm.isNextSub("TYPE"))
2014-05-02 10:47:28 +00:00
{
int keyType;
2014-05-12 19:04:02 +00:00
esm.getHT(keyType);
2014-05-02 10:47:28 +00:00
QuickKey key;
key.mType = keyType;
2023-03-21 19:44:42 +00:00
key.mId = esm.getHNRefId("ID__");
2014-05-02 10:47:28 +00:00
mKeys.push_back(key);
2014-05-12 19:04:02 +00:00
if (esm.isNextSub("KEY_"))
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
2014-05-02 10:47:28 +00:00
}
}
void QuickKeys::save(ESMWriter& esm) const
{
for (std::vector<QuickKey>::const_iterator it = mKeys.begin(); it != mKeys.end(); ++it)
{
esm.writeHNT("TYPE", it->mType);
esm.writeHNRefId("ID__", it->mId);
2014-05-02 10:47:28 +00:00
}
}
}