1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 18:32:36 +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 21:26:05 +03:00
void Locals::load(ESMReader& esm)
{
2022-09-22 21:26:05 +03:00
while (esm.isNextSub("LOCA"))
{
std::string id = esm.getHString();
2022-09-22 21:26:05 +03:00
Variant value;
value.read(esm, Variant::Format_Local);
2022-09-22 21:26:05 +03:00
mVariables.emplace_back(id, value);
}
}
2022-09-22 21:26:05 +03:00
void Locals::save(ESMWriter& esm) const
{
2022-09-22 21:26:05 +03: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);
}
}
}