TrinityCore
Loading...
Searching...
No Matches
WaypointMovementGenerator.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_WAYPOINTMOVEMENTGENERATOR_H
19#define TRINITY_WAYPOINTMOVEMENTGENERATOR_H
20
21#include "MovementGenerator.h"
22#include "PathMovementBase.h"
23#include "Timer.h"
24
25class Creature;
26class Unit;
27struct WaypointPath;
28
29template<class T>
31
32template<>
33class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium<Creature, WaypointMovementGenerator<Creature>>, public PathMovementBase<Creature, WaypointPath const*>
34{
35 public:
36 explicit WaypointMovementGenerator(uint32 pathId = 0, bool repeating = true);
37 explicit WaypointMovementGenerator(WaypointPath& path, bool repeating = true);
38 ~WaypointMovementGenerator() { _path = nullptr; }
39
40 MovementGeneratorType GetMovementGeneratorType() const override;
41
43 void Pause(uint32 timer = 0) override;
44 void Resume(uint32 overrideTimer = 0) override;
45 bool GetResetPosition(Unit*, float& x, float& y, float& z) override;
46
47 bool DoInitialize(Creature*);
48 bool DoReset(Creature*);
49 bool DoUpdate(Creature*, uint32);
50 void DoDeactivate(Creature*);
51 void DoFinalize(Creature*, bool, bool);
52
53 std::string GetDebugInfo() const override;
54
55 private:
56 void MovementInform(Creature*);
57 void OnArrived(Creature*);
58 void StartMove(Creature*, bool relaunch = false);
59 bool ComputeNextNode();
61 {
62 _nextMoveTime.Update(diff);
63 if (_nextMoveTime.Passed())
64 {
65 _nextMoveTime.Reset(0);
66 return true;
67 }
68 return false;
69 }
70
75};
76
77#endif
uint32_t uint32
Definition Define.h:133
std::string GetDebugInfo()
Definition Errors.cpp:155
MovementGeneratorType
@ MOVEMENTGENERATOR_FLAG_SPEED_UPDATE_PENDING
Definition Unit.h:769