replaced movement settings in ref data with new custom data implementation

actorid
Marc Zinnschlag 13 years ago
parent aa87bd4030
commit b0256cea34

@ -3,6 +3,8 @@
#include <memory>
#include <OgreSceneNode.h>
#include <components/esm/loadnpc.hpp>
#include "../mwmechanics/creaturestats.hpp"
@ -12,9 +14,9 @@
#include "../mwworld/actiontalk.hpp"
#include "../mwworld/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwmechanics/movement.hpp"
#include "../mwmechanics/mechanicsmanager.hpp"
#include <OgreSceneNode.h>
namespace
{
@ -25,6 +27,7 @@ namespace
{
MWMechanics::NpcStats mNpcStats;
MWMechanics::CreatureStats mCreatureStats;
MWMechanics::Movement mMovement;
virtual MWWorld::CustomData *clone() const;
};
@ -253,29 +256,20 @@ namespace MWClass
MWMechanics::Movement& Npc::getMovementSettings (const MWWorld::Ptr& ptr) const
{
if (!ptr.getRefData().getMovement().get())
{
boost::shared_ptr<MWMechanics::Movement> movement (
new MWMechanics::Movement);
ptr.getRefData().getMovement() = movement;
}
ensureCustomData (ptr);
return *ptr.getRefData().getMovement();
return dynamic_cast<CustomData&> (*ptr.getRefData().getCustomData()).mMovement;
}
Ogre::Vector3 Npc::getMovementVector (const MWWorld::Ptr& ptr) const
{
Ogre::Vector3 vector (0, 0, 0);
if (ptr.getRefData().getMovement().get())
{
vector.x = - ptr.getRefData().getMovement()->mLeftRight * 200;
vector.y = ptr.getRefData().getMovement()->mForwardBackward * 200;
vector.x = - getMovementSettings (ptr).mLeftRight * 200;
vector.y = getMovementSettings (ptr).mForwardBackward * 200;
if (getStance (ptr, Run, false))
vector *= 2;
}
if (getStance (ptr, Run, false))
vector *= 2;
return vector;
}

@ -3,6 +3,8 @@
#include "../mwrender/player.hpp"
#include "../mwmechanics/movement.hpp"
#include "world.hpp"
#include "class.hpp"

@ -14,7 +14,6 @@ namespace MWWorld
mCount = refData.mCount;
mPosition = refData.mPosition;
mMovement = refData.mMovement;
mContainerStore = refData.mContainerStore;
mCustomData = refData.mCustomData ? refData.mCustomData->clone() : 0;
@ -127,11 +126,6 @@ namespace MWWorld
mEnabled = true;
}
boost::shared_ptr<MWMechanics::Movement>& RefData::getMovement()
{
return mMovement;
}
boost::shared_ptr<ContainerStore<RefData> >& RefData::getContainerStore()
{
return mContainerStore;

@ -9,8 +9,6 @@
#include "../mwscript/locals.hpp"
#include "../mwmechanics/movement.hpp"
#include "containerstore.hpp"
namespace ESM
@ -42,8 +40,6 @@ namespace MWWorld
// assignment operator and destructor. As a consequence though copying a RefData object
// manually will probably give unexcepted results. This is not a problem since RefData
// are never copied outside of container operations.
boost::shared_ptr<MWMechanics::Movement> mMovement;
boost::shared_ptr<ContainerStore<RefData> > mContainerStore;
void copy (const RefData& refData);
@ -86,8 +82,6 @@ namespace MWWorld
void disable();
boost::shared_ptr<MWMechanics::Movement>& getMovement();
boost::shared_ptr<ContainerStore<RefData> >& getContainerStore();
ESM::Position& getPosition();

Loading…
Cancel
Save