1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 10:15:38 +00:00
openmw/components/esm3/locals.cpp

33 lines
714 B
C++
Raw Normal View History

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