2014-08-17 02:58:58 +00:00
|
|
|
#include "magiceffects.hpp"
|
|
|
|
|
|
|
|
#include "esmwriter.hpp"
|
|
|
|
#include "esmreader.hpp"
|
|
|
|
|
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
|
|
|
|
void MagicEffects::save(ESMWriter &esm) const
|
|
|
|
{
|
2021-08-27 18:07:50 +00:00
|
|
|
for (const auto& [key, params] : mEffects)
|
2014-08-17 02:58:58 +00:00
|
|
|
{
|
2021-08-27 18:07:50 +00:00
|
|
|
esm.writeHNT("EFID", key);
|
|
|
|
esm.writeHNT("BASE", params.first);
|
|
|
|
esm.writeHNT("MODI", params.second);
|
2014-08-17 02:58:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MagicEffects::load(ESMReader &esm)
|
|
|
|
{
|
|
|
|
while (esm.isNextSub("EFID"))
|
|
|
|
{
|
2021-08-27 18:07:50 +00:00
|
|
|
int id;
|
|
|
|
std::pair<int, float> params;
|
2014-08-17 02:58:58 +00:00
|
|
|
esm.getHT(id);
|
2021-08-27 18:07:50 +00:00
|
|
|
esm.getHNT(params.first, "BASE");
|
|
|
|
if(esm.getFormat() < 17)
|
|
|
|
params.second = 0.f;
|
|
|
|
else
|
|
|
|
esm.getHNT(params.second, "MODI");
|
|
|
|
mEffects.emplace(id, params);
|
2014-08-17 02:58:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|