TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
HomeMovementGenerator< Creature > Class Template Reference

#include <HomeMovementGenerator.h>

Public Member Functions

 HomeMovementGenerator ()
 
 ~HomeMovementGenerator ()
 
void DoInitialize (Creature *)
 
void DoFinalize (Creature *)
 
void DoReset (Creature *)
 
bool DoUpdate (Creature *, const uint32)
 
MovementGeneratorType GetMovementGeneratorType () const override
 
- Public Member Functions inherited from MovementGeneratorMedium< Creature, HomeMovementGenerator< Creature > >
void Initialize (Unit *u) override
 
void Finalize (Unit *u) override
 
void Reset (Unit *u) override
 
bool Update (Unit *u, uint32 time_diff) override
 
- Public Member Functions inherited from MovementGenerator
virtual ~MovementGenerator ()
 
virtual void unitSpeedChanged ()
 
virtual bool GetResetPosition (Unit *, float &, float &, float &)
 

Private Member Functions

void _setTargetLocation (Creature *)
 

Private Attributes

bool arrived
 

Constructor & Destructor Documentation

34 : arrived(false) { }
bool arrived
Definition: HomeMovementGenerator.h:45

Member Function Documentation

void HomeMovementGenerator< Creature >::_setTargetLocation ( Creature owner)
private
44 {
46  return;
47 
48  Movement::MoveSplineInit init(owner);
49  float x, y, z, o;
50  // at apply we can select more nice return points base at current movegen
51  if (owner->GetMotionMaster()->empty() || !owner->GetMotionMaster()->top()->GetResetPosition(owner, x, y, z))
52  {
53  owner->GetHomePosition(x, y, z, o);
54  init.SetFacing(o);
55  }
56  init.MoveTo(x, y, z);
57  init.SetWalk(false);
58  init.Launch();
59 
60  arrived = false;
61 
63 }
Definition: Unit.h:562
bool arrived
Definition: HomeMovementGenerator.h:45
Definition: Unit.h:594
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
_Ty top() const
Definition: MotionMaster.h:123
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
virtual bool GetResetPosition(Unit *, float &, float &, float &)
Definition: MovementGenerator.h:47
Definition: Unit.h:553
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
Definition: Unit.h:571
Definition: Unit.h:560
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
Definition: MoveSplineInit.h:52
Definition: Unit.h:577
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:672
bool empty() const
Definition: MotionMaster.h:121

+ Here is the call graph for this function:

void HomeMovementGenerator< Creature >::DoFinalize ( Creature owner)
31 {
32  if (arrived)
33  {
35  owner->SetWalk(true);
36  owner->LoadCreaturesAddon();
37  owner->AI()->JustReachedHome();
38  }
39 }
bool arrived
Definition: HomeMovementGenerator.h:45
void ClearUnitState(uint32 f)
Definition: Unit.h:1396
CreatureAI * AI() const
Definition: Creature.h:525
Definition: Unit.h:571
bool SetWalk(bool enable)
Definition: Unit.cpp:15800
virtual void JustReachedHome()
Definition: CreatureAI.h:148
bool LoadCreaturesAddon()
Definition: Creature.cpp:2214

+ Here is the call graph for this function:

void HomeMovementGenerator< Creature >::DoInitialize ( Creature owner)
26 {
27  _setTargetLocation(owner);
28 }
void _setTargetLocation(Creature *)
Definition: HomeMovementGenerator.cpp:43
void HomeMovementGenerator< Creature >::DoReset ( Creature )
41 { }
bool HomeMovementGenerator< Creature >::DoUpdate ( Creature owner,
const uint32   
)
66 {
67  arrived = owner->movespline->Finalized();
68  return !arrived;
69 }
bool arrived
Definition: HomeMovementGenerator.h:45
Movement::MoveSpline * movespline
Definition: Unit.h:2213
bool Finalized() const
Definition: MoveSpline.h:129

+ Here is the call graph for this function:

MovementGeneratorType HomeMovementGenerator< Creature >::GetMovementGeneratorType ( ) const
inlineoverridevirtual

Implements MovementGenerator.

41 { return HOME_MOTION_TYPE; }
Definition: MotionMaster.h:44

Member Data Documentation

bool HomeMovementGenerator< Creature >::arrived
private

The documentation for this class was generated from the following files: