*Backed out changeset 3be01fb200a5

--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-17 15:51:44 -07:00
parent 26b5e033ff
commit e585187b24
2257 changed files with 103863 additions and 761 deletions
+15
View File
@@ -17,27 +17,38 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TRINITY_MOVEMENTGENERATOR_H
#define TRINITY_MOVEMENTGENERATOR_H
#include "Platform/Define.h"
#include "Policies/Singleton.h"
#include "Dynamic/ObjectRegistry.h"
#include "Dynamic/FactoryHolder.h"
#include "Common.h"
#include "MotionMaster.h"
class Unit;
class TRINITY_DLL_SPEC MovementGenerator
{
public:
virtual ~MovementGenerator();
virtual void Initialize(Unit &) = 0;
virtual void Finalize(Unit &) = 0;
virtual void Reset(Unit &) = 0;
virtual bool Update(Unit &, const uint32 &time_diff) = 0;
virtual MovementGeneratorType GetMovementGeneratorType() = 0;
virtual void unitSpeedChanged() { }
virtual bool GetDestination(float& /*x*/, float& /*y*/, float& /*z*/) const { return false; }
};
template<class T, class D>
class TRINITY_DLL_SPEC MovementGeneratorMedium : public MovementGenerator
{
@@ -69,16 +80,20 @@ class TRINITY_DLL_SPEC MovementGeneratorMedium : public MovementGenerator
void Reset(T &u);
bool Update(T &u, const uint32 &time_diff);
};
struct SelectableMovement : public FactoryHolder<MovementGenerator,MovementGeneratorType>
{
SelectableMovement(MovementGeneratorType mgt) : FactoryHolder<MovementGenerator,MovementGeneratorType>(mgt) {}
};
template<class REAL_MOVEMENT>
struct MovementGeneratorFactory : public SelectableMovement
{
MovementGeneratorFactory(MovementGeneratorType mgt) : SelectableMovement(mgt) {}
MovementGenerator* Create(void *) const;
};
typedef FactoryHolder<MovementGenerator,MovementGeneratorType> MovementGeneratorCreator;
typedef FactoryHolder<MovementGenerator,MovementGeneratorType>::FactoryHolderRegistry MovementGeneratorRegistry;
typedef FactoryHolder<MovementGenerator,MovementGeneratorType>::FactoryHolderRepository MovementGeneratorRepository;