Split refdata.hpp in a hpp and a cpp file

Prerequisite for the ContainerStore rewrite, which is a prerequisite for issue #117.
This commit is contained in:
Marc Zinnschlag 2012-01-22 11:00:40 +01:00
parent 0c2de2c00c
commit 6a88133178
3 changed files with 114 additions and 70 deletions

View file

@ -16,7 +16,7 @@ set(GAME_HEADER
source_group(game FILES ${GAME} ${GAME_HEADER}) source_group(game FILES ${GAME} ${GAME_HEADER})
add_openmw_dir (mwrender add_openmw_dir (mwrender
renderingmanager debugging sky player animation npcanimation creatureanimation actors objects renderinginterface renderingmanager debugging sky player animation npcanimation creatureanimation actors objects renderinginterface
) )
add_openmw_dir (mwinput add_openmw_dir (mwinput

View file

@ -0,0 +1,88 @@
#include "refdata.hpp"
namespace MWWorld
{
RefData::RefData (const ESMS::CellRef& cellRef)
: mBaseNode(0), mHasLocals (false), mEnabled (true), mCount (1), mPosition (cellRef.pos)
{}
std::string RefData::getHandle()
{
return mBaseNode->getName();
}
Ogre::SceneNode* RefData::getBaseNode()
{
return mBaseNode;
}
void RefData::setBaseNode(Ogre::SceneNode* base)
{
mBaseNode = base;
}
int RefData::getCount() const
{
return mCount;
}
void RefData::setLocals (const ESM::Script& script)
{
if (!mHasLocals)
{
mLocals.configure (script);
mHasLocals = true;
}
}
void RefData::setCount (int count)
{
mCount = count;
}
MWScript::Locals& RefData::getLocals()
{
return mLocals;
}
bool RefData::isEnabled() const
{
return mEnabled;
}
void RefData::enable()
{
mEnabled = true;
}
void RefData::disable()
{
mEnabled = true;
}
boost::shared_ptr<MWMechanics::CreatureStats>& RefData::getCreatureStats()
{
return mCreatureStats;
}
boost::shared_ptr<MWMechanics::NpcStats>& RefData::getNpcStats()
{
return mNpcStats;
}
boost::shared_ptr<MWMechanics::Movement>& RefData::getMovement()
{
return mMovement;
}
boost::shared_ptr<ContainerStore<RefData> >& RefData::getContainerStore()
{
return mContainerStore;
}
ESM::Position& RefData::getPosition()
{
return mPosition;
}
}

View file

@ -5,6 +5,8 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <Ogre.h>
#include "../mwscript/locals.hpp" #include "../mwscript/locals.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
@ -12,7 +14,6 @@
#include "../mwmechanics/movement.hpp" #include "../mwmechanics/movement.hpp"
#include "containerstore.hpp" #include "containerstore.hpp"
#include <Ogre.h>
namespace ESM namespace ESM
{ {
@ -45,90 +46,45 @@ namespace MWWorld
ESM::Position mPosition; ESM::Position mPosition;
public: public:
/// @param cr Used to copy constant data such as position into this class where it can
/// be altered without effecting the original data. This makes it possible
/// to reset the position as the orignal data is still held in the CellRef
RefData(const ESMS::CellRef& cr) : mBaseNode(0), mHasLocals (false), mEnabled (true),
mCount (1), mPosition(cr.pos) {}
/// @param cellRef Used to copy constant data such as position into this class where it can
/// be altered without effecting the original data. This makes it possible
/// to reset the position as the orignal data is still held in the CellRef
RefData (const ESMS::CellRef& cellRef);
std::string getHandle() /// Return OGRE handle (may be empty).
{ std::string getHandle();
return mBaseNode->getName();
}
Ogre::SceneNode* getBaseNode(){
return mBaseNode;
}
void setBaseNode(Ogre::SceneNode* base){
mBaseNode = base;
}
int getCount() const /// Return OGRE base node (can be a null pointer).
{ Ogre::SceneNode* getBaseNode();
return mCount;
}
void setLocals (const ESM::Script& script) /// Set OGRE base node (can be a null pointer).
{ void setBaseNode (Ogre::SceneNode* base);
if (!mHasLocals)
{
mLocals.configure (script);
mHasLocals = true;
}
}
int getCount() const;
void setCount (int count) void setLocals (const ESM::Script& script);
{
mCount = count;
}
MWScript::Locals& getLocals() void setCount (int count);
{
return mLocals;
}
bool isEnabled() const MWScript::Locals& getLocals();
{
return mEnabled;
}
void enable() bool isEnabled() const;
{
mEnabled = true;
}
void disable() void enable();
{
mEnabled = true;
}
boost::shared_ptr<MWMechanics::CreatureStats>& getCreatureStats() void disable();
{
return mCreatureStats;
}
boost::shared_ptr<MWMechanics::NpcStats>& getNpcStats() boost::shared_ptr<MWMechanics::CreatureStats>& getCreatureStats();
{
return mNpcStats;
}
boost::shared_ptr<MWMechanics::Movement>& getMovement() boost::shared_ptr<MWMechanics::NpcStats>& getNpcStats();
{
return mMovement;
}
boost::shared_ptr<ContainerStore<RefData> >& getContainerStore() boost::shared_ptr<MWMechanics::Movement>& getMovement();
{
return mContainerStore;
}
ESM::Position& getPosition() boost::shared_ptr<ContainerStore<RefData> >& getContainerStore();
{
return mPosition; ESM::Position& getPosition();
}
}; };
} }