2013-12-15 16:16:50 +01:00
|
|
|
#include "locals.hpp"
|
|
|
|
|
|
|
|
#include "esmreader.hpp"
|
|
|
|
#include "esmwriter.hpp"
|
|
|
|
|
2022-04-12 00:18:39 +02:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
void Locals::load(ESMReader& esm)
|
2013-12-15 16:16:50 +01:00
|
|
|
{
|
2022-09-22 21:26:05 +03:00
|
|
|
while (esm.isNextSub("LOCA"))
|
|
|
|
{
|
|
|
|
std::string id = esm.getHString();
|
2013-12-15 16:16:50 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
Variant value;
|
|
|
|
value.read(esm, Variant::Format_Local);
|
2013-12-15 16:16:50 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
mVariables.emplace_back(id, value);
|
|
|
|
}
|
2013-12-15 16:16:50 +01:00
|
|
|
}
|
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
void Locals::save(ESMWriter& esm) const
|
2013-12-15 16:16:50 +01:00
|
|
|
{
|
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);
|
|
|
|
}
|
2013-12-15 16:16:50 +01:00
|
|
|
}
|
2022-04-12 00:18:39 +02:00
|
|
|
|
|
|
|
}
|