forked from teamnwah/openmw-tes3coop
Store magic effect Base values in savegame (Fixes #1489)
parent
2db50da8dd
commit
360c7f863c
@ -0,0 +1,29 @@
|
||||
#include "magiceffects.hpp"
|
||||
|
||||
#include "esmwriter.hpp"
|
||||
#include "esmreader.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
||||
void MagicEffects::save(ESMWriter &esm) const
|
||||
{
|
||||
for (std::map<int, int>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
||||
{
|
||||
esm.writeHNT("EFID", it->first);
|
||||
esm.writeHNT("BASE", it->second);
|
||||
}
|
||||
}
|
||||
|
||||
void MagicEffects::load(ESMReader &esm)
|
||||
{
|
||||
while (esm.isNextSub("EFID"))
|
||||
{
|
||||
int id, base;
|
||||
esm.getHT(id);
|
||||
esm.getHNT(base, "BASE");
|
||||
mEffects.insert(std::make_pair(id, base));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
#ifndef COMPONENTS_ESM_MAGICEFFECTS_H
|
||||
#define COMPONENTS_ESM_MAGICEFFECTS_H
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ESMReader;
|
||||
class ESMWriter;
|
||||
|
||||
// format 0, saved games only
|
||||
struct MagicEffects
|
||||
{
|
||||
// <Effect Id, Base value>
|
||||
std::map<int, int> mEffects;
|
||||
|
||||
void load (ESMReader &esm);
|
||||
void save (ESMWriter &esm) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue