Various Cleanups (game L-M)

This commit is contained in:
Schmoozerd 2012-07-19 21:46:40 +02:00
parent 2bd41afb3e
commit 8d0c106aa4
29 changed files with 2201 additions and 2163 deletions

View file

@ -34,16 +34,16 @@ class MANGOS_DLL_SPEC MovementGenerator
virtual ~MovementGenerator();
// called before adding movement generator to motion stack
virtual void Initialize(Unit &) = 0;
virtual void Initialize(Unit&) = 0;
// called aftre remove movement generator from motion stack
virtual void Finalize(Unit &) = 0;
virtual void Finalize(Unit&) = 0;
// called before lost top position (before push new movement generator above)
virtual void Interrupt(Unit &) = 0;
virtual void Interrupt(Unit&) = 0;
// called after return movement generator to top position (after remove above movement generator)
virtual void Reset(Unit &) = 0;
virtual void Reset(Unit&) = 0;
virtual bool Update(Unit &, const uint32 &time_diff) = 0;
virtual bool Update(Unit&, const uint32& time_diff) = 0;
virtual MovementGeneratorType GetMovementGeneratorType() const = 0;
@ -52,7 +52,7 @@ class MANGOS_DLL_SPEC MovementGenerator
virtual void UpdateFinalDistance(float /*fDistance*/) { }
// used by Evade code for select point to evade with expected restart default movement
virtual bool GetResetPosition(Unit &, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
virtual bool GetResetPosition(Unit&, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
// given destination unreachable? due to pathfinsing or other
virtual bool IsReachable() const { return true; }
@ -66,27 +66,27 @@ template<class T, class D>
class MANGOS_DLL_SPEC MovementGeneratorMedium : public MovementGenerator
{
public:
void Initialize(Unit &u)
void Initialize(Unit& u)
{
//u->AssertIsType<T>();
(static_cast<D*>(this))->Initialize(*((T*)&u));
}
void Finalize(Unit &u)
void Finalize(Unit& u)
{
//u->AssertIsType<T>();
(static_cast<D*>(this))->Finalize(*((T*)&u));
}
void Interrupt(Unit &u)
void Interrupt(Unit& u)
{
//u->AssertIsType<T>();
(static_cast<D*>(this))->Interrupt(*((T*)&u));
}
void Reset(Unit &u)
void Reset(Unit& u)
{
//u->AssertIsType<T>();
(static_cast<D*>(this))->Reset(*((T*)&u));
}
bool Update(Unit &u, const uint32 &time_diff)
bool Update(Unit& u, const uint32& time_diff)
{
//u->AssertIsType<T>();
return (static_cast<D*>(this))->Update(*((T*)&u), time_diff);
@ -98,11 +98,11 @@ class MANGOS_DLL_SPEC MovementGeneratorMedium : public MovementGenerator
}
public:
// will not link if not overridden in the generators
void Initialize(T &u);
void Finalize(T &u);
void Interrupt(T &u);
void Reset(T &u);
bool Update(T &u, const uint32 &time_diff);
void Initialize(T& u);
void Finalize(T& u);
void Interrupt(T& u);
void Reset(T& u);
bool Update(T& u, const uint32& time_diff);
// not need always overwrites
bool GetResetPosition(T& /*u*/, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
@ -118,7 +118,7 @@ struct MovementGeneratorFactory : public SelectableMovement
{
MovementGeneratorFactory(MovementGeneratorType mgt) : SelectableMovement(mgt) {}
MovementGenerator* Create(void *) const;
MovementGenerator* Create(void*) const;
};
typedef FactoryHolder<MovementGenerator,MovementGeneratorType> MovementGeneratorCreator;