mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[9542] Make MovementGenerator::GetMovementGeneratorType() const
This commit is contained in:
parent
66f0e6662f
commit
531b3b669e
12 changed files with 36 additions and 35 deletions
|
|
@ -38,7 +38,7 @@ class MANGOS_DLL_SPEC ConfusedMovementGenerator
|
||||||
void Reset(T &);
|
void Reset(T &);
|
||||||
bool Update(T &, const uint32 &);
|
bool Update(T &, const uint32 &);
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return CONFUSED_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return CONFUSED_MOTION_TYPE; }
|
||||||
private:
|
private:
|
||||||
void _InitSpecific(T &, bool &, bool &);
|
void _InitSpecific(T &, bool &, bool &);
|
||||||
TimeTracker i_nextMoveTime;
|
TimeTracker i_nextMoveTime;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class MANGOS_DLL_SPEC FleeingMovementGenerator
|
||||||
void Reset(T &);
|
void Reset(T &);
|
||||||
bool Update(T &, const uint32 &);
|
bool Update(T &, const uint32 &);
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return FLEEING_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return FLEEING_MOTION_TYPE; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _setTargetLocation(T &owner);
|
void _setTargetLocation(T &owner);
|
||||||
|
|
@ -68,7 +68,7 @@ class MANGOS_DLL_SPEC TimedFleeingMovementGenerator
|
||||||
FleeingMovementGenerator<Creature>(fright),
|
FleeingMovementGenerator<Creature>(fright),
|
||||||
i_totalFleeTime(time) {}
|
i_totalFleeTime(time) {}
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return TIMED_FLEEING_MOTION_TYPE; }
|
||||||
bool Update(Unit &, const uint32 &);
|
bool Update(Unit &, const uint32 &);
|
||||||
void Finalize(Unit &);
|
void Finalize(Unit &);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class MANGOS_DLL_SPEC HomeMovementGenerator<Creature>
|
||||||
void Reset(Creature &);
|
void Reset(Creature &);
|
||||||
bool Update(Creature &, const uint32 &);
|
bool Update(Creature &, const uint32 &);
|
||||||
void modifyTravelTime(uint32 travel_time) { i_travel_timer = travel_time; }
|
void modifyTravelTime(uint32 travel_time) { i_travel_timer = travel_time; }
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return HOME_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return HOME_MOTION_TYPE; }
|
||||||
|
|
||||||
bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; }
|
bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x,y,z); return true; }
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class MANGOS_DLL_SPEC IdleMovementGenerator : public MovementGenerator
|
||||||
void Interrupt(Unit &) {}
|
void Interrupt(Unit &) {}
|
||||||
void Reset(Unit &);
|
void Reset(Unit &);
|
||||||
bool Update(Unit &, const uint32 &) { return true; }
|
bool Update(Unit &, const uint32 &) { return true; }
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return IDLE_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return IDLE_MOTION_TYPE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern IdleMovementGenerator si_idleMovement;
|
extern IdleMovementGenerator si_idleMovement;
|
||||||
|
|
@ -45,7 +45,7 @@ class MANGOS_DLL_SPEC DistractMovementGenerator : public MovementGenerator
|
||||||
void Interrupt(Unit& );
|
void Interrupt(Unit& );
|
||||||
void Reset(Unit& );
|
void Reset(Unit& );
|
||||||
bool Update(Unit& owner, const uint32& time_diff);
|
bool Update(Unit& owner, const uint32& time_diff);
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return DISTRACT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return DISTRACT_MOTION_TYPE; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32 m_timer;
|
uint32 m_timer;
|
||||||
|
|
@ -57,7 +57,7 @@ class MANGOS_DLL_SPEC AssistanceDistractMovementGenerator : public DistractMovem
|
||||||
AssistanceDistractMovementGenerator(uint32 timer) :
|
AssistanceDistractMovementGenerator(uint32 timer) :
|
||||||
DistractMovementGenerator(timer) {}
|
DistractMovementGenerator(timer) {}
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return ASSISTANCE_DISTRACT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return ASSISTANCE_DISTRACT_MOTION_TYPE; }
|
||||||
void Finalize(Unit& unit);
|
void Finalize(Unit& unit);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5620,7 +5620,6 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
|
||||||
case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
|
case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
|
||||||
case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break;
|
case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break;
|
||||||
case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break;
|
case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break;
|
||||||
case ANIMAL_RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); break;
|
|
||||||
case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break;
|
case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break;
|
||||||
case CHASE_MOTION_TYPE:
|
case CHASE_MOTION_TYPE:
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,22 +32,22 @@ class Unit;
|
||||||
// values 0 ... MAX_DB_MOTION_TYPE-1 used in DB
|
// values 0 ... MAX_DB_MOTION_TYPE-1 used in DB
|
||||||
enum MovementGeneratorType
|
enum MovementGeneratorType
|
||||||
{
|
{
|
||||||
IDLE_MOTION_TYPE = 0, // IdleMovementGenerator.h
|
IDLE_MOTION_TYPE = 0, // IdleMovementGenerator.h
|
||||||
RANDOM_MOTION_TYPE = 1, // RandomMovementGenerator.h
|
RANDOM_MOTION_TYPE = 1, // RandomMovementGenerator.h
|
||||||
WAYPOINT_MOTION_TYPE = 2, // WaypointMovementGenerator.h
|
WAYPOINT_MOTION_TYPE = 2, // WaypointMovementGenerator.h
|
||||||
MAX_DB_MOTION_TYPE = 3, // *** this and below motion types can't be set in DB.
|
MAX_DB_MOTION_TYPE = 3, // *** this and below motion types can't be set in DB.
|
||||||
ANIMAL_RANDOM_MOTION_TYPE = MAX_DB_MOTION_TYPE, // Just a dummy
|
|
||||||
CONFUSED_MOTION_TYPE = 4, // ConfusedMovementGenerator.h
|
CONFUSED_MOTION_TYPE = 4, // ConfusedMovementGenerator.h
|
||||||
CHASE_MOTION_TYPE = 5, // TargetedMovementGenerator.h
|
CHASE_MOTION_TYPE = 5, // TargetedMovementGenerator.h
|
||||||
HOME_MOTION_TYPE = 6, // HomeMovementGenerator.h
|
HOME_MOTION_TYPE = 6, // HomeMovementGenerator.h
|
||||||
FLIGHT_MOTION_TYPE = 7, // WaypointMovementGenerator.h
|
FLIGHT_MOTION_TYPE = 7, // WaypointMovementGenerator.h
|
||||||
POINT_MOTION_TYPE = 8, // PointMovementGenerator.h
|
POINT_MOTION_TYPE = 8, // PointMovementGenerator.h
|
||||||
FLEEING_MOTION_TYPE = 9, // FleeingMovementGenerator.h
|
FLEEING_MOTION_TYPE = 9, // FleeingMovementGenerator.h
|
||||||
DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h
|
DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h
|
||||||
ASSISTANCE_MOTION_TYPE= 11, // PointMovementGenerator.h (first part of flee for assistance)
|
ASSISTANCE_MOTION_TYPE = 11, // PointMovementGenerator.h (first part of flee for assistance)
|
||||||
ASSISTANCE_DISTRACT_MOTION_TYPE = 12, // IdleMovementGenerator.h (second part of flee for assistance)
|
ASSISTANCE_DISTRACT_MOTION_TYPE = 12, // IdleMovementGenerator.h (second part of flee for assistance)
|
||||||
TIMED_FLEEING_MOTION_TYPE = 13, // FleeingMovementGenerator.h (alt.second part of flee for assistance)
|
TIMED_FLEEING_MOTION_TYPE = 13, // FleeingMovementGenerator.h (alt.second part of flee for assistance)
|
||||||
FOLLOW_MOTION_TYPE = 14, // TargetedMovementGenerator.h
|
FOLLOW_MOTION_TYPE = 14, // TargetedMovementGenerator.h
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MMCleanFlag
|
enum MMCleanFlag
|
||||||
|
|
@ -99,12 +99,12 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
|
||||||
void MoveFollow(Unit* target, float dist, float angle);
|
void MoveFollow(Unit* target, float dist, float angle);
|
||||||
void MoveChase(Unit* target, float dist = 0.0f, float angle = 0.0f);
|
void MoveChase(Unit* target, float dist = 0.0f, float angle = 0.0f);
|
||||||
void MoveConfused();
|
void MoveConfused();
|
||||||
void MoveFleeing(Unit* enemy, uint32 time = 0);
|
void MoveFleeing(Unit* enemy, uint32 timeLimit = 0);
|
||||||
void MovePoint(uint32 id, float x,float y,float z);
|
void MovePoint(uint32 id, float x,float y,float z);
|
||||||
void MoveSeekAssistance(float x,float y,float z);
|
void MoveSeekAssistance(float x,float y,float z);
|
||||||
void MoveSeekAssistanceDistract(uint32 timer);
|
void MoveSeekAssistanceDistract(uint32 timer);
|
||||||
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
void MoveTaxiFlight(uint32 path, uint32 pathnode);
|
||||||
void MoveDistract(uint32 time);
|
void MoveDistract(uint32 timeLimit);
|
||||||
|
|
||||||
MovementGeneratorType GetCurrentMovementGeneratorType() const;
|
MovementGeneratorType GetCurrentMovementGeneratorType() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class MANGOS_DLL_SPEC MovementGenerator
|
||||||
|
|
||||||
virtual bool Update(Unit &, const uint32 &time_diff) = 0;
|
virtual bool Update(Unit &, const uint32 &time_diff) = 0;
|
||||||
|
|
||||||
virtual MovementGeneratorType GetMovementGeneratorType() = 0;
|
virtual MovementGeneratorType GetMovementGeneratorType() const = 0;
|
||||||
|
|
||||||
virtual void unitSpeedChanged() { }
|
virtual void unitSpeedChanged() { }
|
||||||
|
|
||||||
|
|
@ -123,5 +123,6 @@ struct MovementGeneratorFactory : public SelectableMovement
|
||||||
typedef FactoryHolder<MovementGenerator,MovementGeneratorType> MovementGeneratorCreator;
|
typedef FactoryHolder<MovementGenerator,MovementGeneratorType> MovementGeneratorCreator;
|
||||||
typedef FactoryHolder<MovementGenerator,MovementGeneratorType>::FactoryHolderRegistry MovementGeneratorRegistry;
|
typedef FactoryHolder<MovementGenerator,MovementGeneratorType>::FactoryHolderRegistry MovementGeneratorRegistry;
|
||||||
typedef FactoryHolder<MovementGenerator,MovementGeneratorType>::FactoryHolderRepository MovementGeneratorRepository;
|
typedef FactoryHolder<MovementGenerator,MovementGeneratorType>::FactoryHolderRepository MovementGeneratorRepository;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class MANGOS_DLL_SPEC PointMovementGenerator
|
||||||
|
|
||||||
void MovementInform(T &);
|
void MovementInform(T &);
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return POINT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return POINT_MOTION_TYPE; }
|
||||||
|
|
||||||
bool GetDestination(float& x, float& y, float& z) const { x=i_x; y=i_y; z=i_z; return true; }
|
bool GetDestination(float& x, float& y, float& z) const { x=i_x; y=i_y; z=i_z; return true; }
|
||||||
private:
|
private:
|
||||||
|
|
@ -57,7 +57,7 @@ class MANGOS_DLL_SPEC AssistanceMovementGenerator
|
||||||
AssistanceMovementGenerator(float _x, float _y, float _z) :
|
AssistanceMovementGenerator(float _x, float _y, float _z) :
|
||||||
PointMovementGenerator<Creature>(0, _x, _y, _z) {}
|
PointMovementGenerator<Creature>(0, _x, _y, _z) {}
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return ASSISTANCE_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return ASSISTANCE_MOTION_TYPE; }
|
||||||
void Finalize(Unit &);
|
void Finalize(Unit &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class MANGOS_DLL_SPEC RandomMovementGenerator
|
||||||
: public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
: public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RandomMovementGenerator(const Unit &) : i_nextMoveTime(0) {}
|
explicit RandomMovementGenerator(const Unit &) : i_nextMoveTime(0) {}
|
||||||
|
|
||||||
void _setRandomLocation(T &);
|
void _setRandomLocation(T &);
|
||||||
void Initialize(T &);
|
void Initialize(T &);
|
||||||
|
|
@ -40,7 +40,7 @@ class MANGOS_DLL_SPEC RandomMovementGenerator
|
||||||
{
|
{
|
||||||
i_destinationHolder.GetLocationNow(mapid, x,y,z);
|
i_destinationHolder.GetLocationNow(mapid, x,y,z);
|
||||||
}
|
}
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return RANDOM_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return RANDOM_MOTION_TYPE; }
|
||||||
|
|
||||||
bool GetResetPosition(T&, float& x, float& y, float& z);
|
bool GetResetPosition(T&, float& x, float& y, float& z);
|
||||||
private:
|
private:
|
||||||
|
|
@ -49,4 +49,5 @@ class MANGOS_DLL_SPEC RandomMovementGenerator
|
||||||
DestinationHolder< Traveller<T> > i_destinationHolder;
|
DestinationHolder< Traveller<T> > i_destinationHolder;
|
||||||
uint32 i_nextMove;
|
uint32 i_nextMove;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class MANGOS_DLL_SPEC ChaseMovementGenerator : public TargetedMovementGeneratorM
|
||||||
: TargetedMovementGeneratorMedium<T, ChaseMovementGenerator<T> >(target, offset, angle) {}
|
: TargetedMovementGeneratorMedium<T, ChaseMovementGenerator<T> >(target, offset, angle) {}
|
||||||
~ChaseMovementGenerator() {}
|
~ChaseMovementGenerator() {}
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return CHASE_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return CHASE_MOTION_TYPE; }
|
||||||
|
|
||||||
void Initialize(T &);
|
void Initialize(T &);
|
||||||
void Finalize(T &);
|
void Finalize(T &);
|
||||||
|
|
@ -103,7 +103,7 @@ class MANGOS_DLL_SPEC FollowMovementGenerator : public TargetedMovementGenerator
|
||||||
: TargetedMovementGeneratorMedium<T, FollowMovementGenerator<T> >(target, offset, angle) {}
|
: TargetedMovementGeneratorMedium<T, FollowMovementGenerator<T> >(target, offset, angle) {}
|
||||||
~FollowMovementGenerator() {}
|
~FollowMovementGenerator() {}
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return FOLLOW_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return FOLLOW_MOTION_TYPE; }
|
||||||
|
|
||||||
void Initialize(T &);
|
void Initialize(T &);
|
||||||
void Finalize(T &);
|
void Finalize(T &);
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ public PathMovementBase<Creature, WaypointPath const*>
|
||||||
|
|
||||||
void MovementInform(Creature &);
|
void MovementInform(Creature &);
|
||||||
|
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return WAYPOINT_MOTION_TYPE; }
|
||||||
|
|
||||||
// now path movement implmementation
|
// now path movement implmementation
|
||||||
void LoadPath(Creature &c);
|
void LoadPath(Creature &c);
|
||||||
|
|
@ -121,7 +121,7 @@ public PathMovementBase<Player>
|
||||||
void Interrupt(Player &);
|
void Interrupt(Player &);
|
||||||
void Reset(Player &);
|
void Reset(Player &);
|
||||||
bool Update(Player &, const uint32 &);
|
bool Update(Player &, const uint32 &);
|
||||||
MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; }
|
MovementGeneratorType GetMovementGeneratorType() const { return FLIGHT_MOTION_TYPE; }
|
||||||
|
|
||||||
void LoadPath(Player &);
|
void LoadPath(Player &);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9541"
|
#define REVISION_NR "9542"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue