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
25
class
Creature
;
26
class
Unit
;
27
struct
WaypointPath
;
28
29
template
<
class
T>
30
class
WaypointMovementGenerator
;
31
32
template
<>
33
class
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
42
void
UnitSpeedChanged
()
override
{ AddFlag(
MOVEMENTGENERATOR_FLAG_SPEED_UPDATE_PENDING
); }
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();
60
bool
UpdateTimer
(
uint32
diff)
61
{
62
_nextMoveTime.Update(diff);
63
if
(_nextMoveTime.Passed())
64
{
65
_nextMoveTime.Reset(0);
66
return
true
;
67
}
68
return
false
;
69
}
70
71
TimeTracker
_nextMoveTime
;
72
uint32
_pathId
;
73
bool
_repeating
;
74
bool
_loadedFromDB
;
75
};
76
77
#endif
uint32
uint32_t uint32
Definition
Define.h:133
GetDebugInfo
std::string GetDebugInfo()
Definition
Errors.cpp:155
MovementGeneratorType
MovementGeneratorType
Definition
MovementDefines.h:27
MovementGenerator.h
MOVEMENTGENERATOR_FLAG_SPEED_UPDATE_PENDING
@ MOVEMENTGENERATOR_FLAG_SPEED_UPDATE_PENDING
Definition
MovementGenerator.h:35
PathMovementBase.h
Timer.h
Creature
Definition
Creature.h:62
MovementGeneratorMedium
Definition
MovementGenerator.h:87
PathMovementBase
Definition
PathMovementBase.h:26
Unit
Definition
Unit.h:769
WaypointMovementGenerator< Creature >::_nextMoveTime
TimeTracker _nextMoveTime
Definition
WaypointMovementGenerator.h:71
WaypointMovementGenerator< Creature >::~WaypointMovementGenerator
~WaypointMovementGenerator()
Definition
WaypointMovementGenerator.h:38
WaypointMovementGenerator< Creature >::_loadedFromDB
bool _loadedFromDB
Definition
WaypointMovementGenerator.h:74
WaypointMovementGenerator< Creature >::UpdateTimer
bool UpdateTimer(uint32 diff)
Definition
WaypointMovementGenerator.h:60
WaypointMovementGenerator< Creature >::_repeating
bool _repeating
Definition
WaypointMovementGenerator.h:73
WaypointMovementGenerator< Creature >::UnitSpeedChanged
void UnitSpeedChanged() override
Definition
WaypointMovementGenerator.h:42
WaypointMovementGenerator< Creature >::_pathId
uint32 _pathId
Definition
WaypointMovementGenerator.h:72
WaypointMovementGenerator
Definition
WaypointMovementGenerator.h:30
TimeTracker
Definition
Timer.h:116
WaypointPath
Definition
WaypointDefines.h:61
server
game
Movement
MovementGenerators
WaypointMovementGenerator.h
Generated on Sun May 10 2026 02:30:17 for TrinityCore by
1.9.8