2013-12-15 15:16:50 +00:00
|
|
|
#include "locals.hpp"
|
|
|
|
|
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
|
|
|
|
2022-04-11 22:18:39 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
|
|
|
void Locals::load(ESMReader& esm)
|
2013-12-15 15:16:50 +00:00
|
|
|
{
|
|
|
|
while (esm.isNextSub("LOCA"))
|
2022-09-22 18:26:05 +00:00
|
|
|
{
|
2013-12-15 15:16:50 +00:00
|
|
|
std::string id = esm.getHString();
|
|
|
|
|
|
|
|
Variant value;
|
2015-01-24 15:15:52 +00:00
|
|
|
value.read(esm, Variant::Format_Local);
|
2013-12-15 15:16:50 +00:00
|
|
|
|
2020-10-17 08:26:35 +00:00
|
|
|
mVariables.emplace_back(id, value);
|
2022-09-22 18:26:05 +00:00
|
|
|
}
|
2013-12-15 15:16:50 +00:00
|
|
|
}
|
|
|
|
|
2022-04-11 22:18:39 +00:00
|
|
|
void Locals::save(ESMWriter& esm) const
|
2013-12-15 15:16:50 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
{
|
2013-12-15 15:16:50 +00:00
|
|
|
esm.writeHNString("LOCA", iter->first);
|
2015-01-24 15:15:52 +00:00
|
|
|
iter->second.write(esm, Variant::Format_Local);
|
2022-09-22 18:26:05 +00:00
|
|
|
}
|
2013-12-15 15:16:50 +00:00
|
|
|
}
|
2022-04-11 22:18:39 +00:00
|
|
|
|
|
|
|
}
|