You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
888 B
C++
44 lines
888 B
C++
11 years ago
|
#include "quickkeys.hpp"
|
||
|
|
||
|
#include "esmwriter.hpp"
|
||
|
#include "esmreader.hpp"
|
||
|
|
||
|
namespace ESM
|
||
|
{
|
||
|
|
||
|
void QuickKeys::load(ESMReader &esm)
|
||
|
{
|
||
|
while (esm.isNextSub("KEY_"))
|
||
|
{
|
||
|
esm.getSubHeader();
|
||
|
int keyType;
|
||
|
esm.getHNT(keyType, "TYPE");
|
||
|
std::string id;
|
||
|
id = esm.getHNString("ID__");
|
||
|
|
||
|
QuickKey key;
|
||
|
key.mType = keyType;
|
||
|
key.mId = id;
|
||
|
|
||
|
mKeys.push_back(key);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void QuickKeys::save(ESMWriter &esm) const
|
||
|
{
|
||
|
const std::string recKey = "KEY_";
|
||
|
|
||
|
for (std::vector<QuickKey>::const_iterator it = mKeys.begin(); it != mKeys.end(); ++it)
|
||
|
{
|
||
|
esm.startSubRecord(recKey);
|
||
|
|
||
|
esm.writeHNT("TYPE", it->mType);
|
||
|
esm.writeHNString("ID__", it->mId);
|
||
|
|
||
|
esm.endRecord(recKey);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|