1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 18:32:36 +00:00
OpenMW/components/esm3/quickkeys.cpp

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

37 lines
873 B
C++
Raw Normal View History

2014-05-02 12:47:28 +02:00
#include "quickkeys.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void QuickKeys::load(ESMReader& esm)
{
2014-05-12 21:04:02 +02: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 12:47:28 +02:00
{
QuickKey key;
esm.getHT(key.mType);
2023-03-21 20:44:42 +01:00
key.mId = esm.getHNRefId("ID__");
2014-05-02 12:47:28 +02:00
mKeys.push_back(key);
2014-05-12 21:04:02 +02:00
if (esm.isNextSub("KEY_"))
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
2014-05-02 12:47:28 +02:00
}
}
void QuickKeys::save(ESMWriter& esm) const
{
2023-03-21 20:45:49 +01:00
for (const QuickKey& key : mKeys)
2014-05-02 12:47:28 +02:00
{
2023-03-21 20:45:49 +01:00
esm.writeHNT("TYPE", key.mType);
esm.writeHNRefId("ID__", key.mId);
2014-05-02 12:47:28 +02:00
}
}
}