Explicitly instantiate ESM::StatState

c++11
Alexander "Ace" Olofsson 10 years ago
parent 13f289d1a5
commit 3655ef16af

@ -1,5 +1,7 @@
#include "convertplayer.hpp"
#include <components/misc/stringops.hpp>
namespace ESSImport
{

@ -10,6 +10,7 @@
#include <components/esm/loaddial.hpp>
#include <components/esm/loadinfo.hpp>
#include <components/esm/dialoguestate.hpp>
#include <components/esm/esmwriter.hpp>
#include <components/compiler/exception.hpp>
#include <components/compiler/errorhandler.hpp>

@ -10,6 +10,8 @@
#include <osg/Texture2D>
#include <components/misc/stringops.hpp>
#include <components/myguiplatform/myguitexture.hpp>
#include <components/settings/settings.hpp>

@ -12,6 +12,7 @@
#include <MyGUI_FactoryManager.h>
#include <components/esm/globalmap.hpp>
#include <components/esm/esmwriter.hpp>
#include <components/settings/settings.hpp>
#include <components/myguiplatform/myguitexture.hpp>

@ -5,6 +5,7 @@
#include <MyGUI_Gui.h>
#include <MyGUI_ImageBox.h>
#include <components/esm/esmwriter.hpp>
#include <components/esm/quickkeys.hpp>
#include "../mwworld/inventorystore.hpp"

@ -22,6 +22,9 @@
#include <components/sdlutil/sdlcursormanager.hpp>
#include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp>
#include <components/fontloader/fontloader.hpp>
#include <components/resource/resourcesystem.hpp>

@ -4,6 +4,8 @@
#include <osg/PositionAttitudeTransform>
#include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp>
#include <components/esm/loadnpc.hpp>
#include "../mwworld/esmstore.hpp"

@ -3,6 +3,8 @@
#include <algorithm>
#include <components/esm/creaturestats.hpp>
#include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp>
#include "../mwworld/esmstore.hpp"

@ -6,6 +6,7 @@
#include <components/misc/rng.hpp>
#include <components/esm/esmwriter.hpp>
#include <components/esm/stolenitems.hpp>
#include "../mwworld/esmstore.hpp"

@ -1,6 +1,7 @@
#ifndef GAME_MWMECHANICS_STAT_H
#define GAME_MWMECHANICS_STAT_H
#include <algorithm>
#include <limits>
#include <components/esm/statstate.hpp>

@ -5,6 +5,7 @@
#include <components/esm/cellstate.hpp>
#include <components/esm/cellid.hpp>
#include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp>
#include <components/esm/objectstate.hpp>
#include <components/esm/containerstate.hpp>

@ -2,6 +2,7 @@
#include <osg/PositionAttitudeTransform>
#include <components/esm/esmwriter.hpp>
#include <components/esm/projectilestate.hpp>
#include <components/resource/resourcesystem.hpp>
#include <components/resource/scenemanager.hpp>

@ -12,6 +12,9 @@
#include <osg/ComputeBoundsVisitor>
#include <osg/PositionAttitudeTransform>
#include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp>
#include <components/misc/rng.hpp>
#include <components/files/collections.hpp>

@ -1,4 +1,6 @@
#include "creaturestats.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
void ESM::CreatureStats::load (ESMReader &esm)
{

@ -0,0 +1,52 @@
#include "statstate.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
template<typename T>
StatState<T>::StatState() : mBase(0), mMod(0), mCurrent(0), mDamage(0), mProgress(0) {}
template<typename T>
void StatState<T>::load(ESMReader &esm)
{
esm.getHNT(mBase, "STBA");
mMod = 0;
esm.getHNOT(mMod, "STMO");
mCurrent = 0;
esm.getHNOT(mCurrent, "STCU");
// mDamage was changed to a float; ensure backwards compatibility
T oldDamage = 0;
esm.getHNOT(oldDamage, "STDA");
mDamage = static_cast<float>(oldDamage);
esm.getHNOT(mDamage, "STDF");
mProgress = 0;
esm.getHNOT(mProgress, "STPR");
}
template<typename T>
void StatState<T>::save(ESMWriter &esm) const
{
esm.writeHNT("STBA", mBase);
if (mMod != 0)
esm.writeHNT("STMO", mMod);
if (mCurrent)
esm.writeHNT("STCU", mCurrent);
if (mDamage)
esm.writeHNT("STDF", mDamage);
if (mProgress)
esm.writeHNT("STPR", mProgress);
}
template class StatState<int>;
template class StatState<float>;
}

@ -1,11 +1,11 @@
#ifndef OPENMW_ESM_STATSTATE_H
#define OPENMW_ESM_STATSTATE_H
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
class ESMReader;
class ESMWriter;
// format 0, saved games only
template<typename T>
@ -23,48 +23,6 @@ namespace ESM
void load (ESMReader &esm);
void save (ESMWriter &esm) const;
};
template<typename T>
StatState<T>::StatState() : mBase (0), mMod (0), mCurrent (0), mDamage (0), mProgress (0) {}
template<typename T>
void StatState<T>::load (ESMReader &esm)
{
esm.getHNT (mBase, "STBA");
mMod = 0;
esm.getHNOT (mMod, "STMO");
mCurrent = 0;
esm.getHNOT (mCurrent, "STCU");
// mDamage was changed to a float; ensure backwards compatibility
T oldDamage = 0;
esm.getHNOT(oldDamage, "STDA");
mDamage = static_cast<float>(oldDamage);
esm.getHNOT (mDamage, "STDF");
mProgress = 0;
esm.getHNOT (mProgress, "STPR");
}
template<typename T>
void StatState<T>::save (ESMWriter &esm) const
{
esm.writeHNT ("STBA", mBase);
if (mMod != 0)
esm.writeHNT ("STMO", mMod);
if (mCurrent)
esm.writeHNT ("STCU", mCurrent);
if (mDamage)
esm.writeHNT ("STDF", mDamage);
if (mProgress)
esm.writeHNT ("STPR", mProgress);
}
}
#endif

Loading…
Cancel
Save