1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00
OpenMW/components/esm3/locals.cpp

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

33 lines
714 B
C++
Raw Normal View History

#include "locals.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void Locals::load(ESMReader& esm)
{
while (esm.isNextSub("LOCA"))
2022-09-22 18:26:05 +00:00
{
std::string id = esm.getHString();
Variant value;
value.read(esm, Variant::Format_Local);
2020-10-17 08:26:35 +00:00
mVariables.emplace_back(id, value);
2022-09-22 18:26:05 +00:00
}
}
void Locals::save(ESMWriter& esm) const
{
for (std::vector<std::pair<std::string, Variant>>::const_iterator iter(mVariables.begin());
iter != mVariables.end(); ++iter)
2022-09-22 18:26:05 +00:00
{
esm.writeHNString("LOCA", iter->first);
iter->second.write(esm, Variant::Format_Local);
2022-09-22 18:26:05 +00:00
}
}
}