TrinityCore
WaypointDefines.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_WAYPOINTDEFINES_H
19#define TRINITY_WAYPOINTDEFINES_H
20
21#include "Define.h"
22#include "Duration.h"
23#include "EnumFlag.h"
24#include "Optional.h"
25#include <vector>
26
27static inline constexpr std::size_t WAYPOINT_PATH_FLAG_FOLLOW_PATH_BACKWARDS_MINIMUM_NODES = 2;
28
30{
31 Walk = 0,
32 Run = 1,
33 Land = 2,
34 TakeOff = 3,
35
36 Max
37};
38
40{
41 None = 0x00,
43 ExactSplinePath = 0x02, // Points are going to be merged into single packets and pathfinding is disabled
44
45 FlyingPath = ExactSplinePath // flying paths are always exact splines
46};
47
49
51{
52 constexpr WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), MoveType(WaypointMoveType::Walk) { }
53 constexpr WaypointNode(uint32 id, float x, float y, float z, Optional<float> orientation = { }, Optional<Milliseconds> delay = {})
54 {
55 Id = id;
56 X = x;
57 Y = y;
58 Z = z;
59 Orientation = orientation;
60 Delay = delay;
62 }
63
65 float X;
66 float Y;
67 float Z;
71};
72
74{
75 WaypointPath() = default;
77 {
78 Id = id;
79 Nodes = std::move(nodes);
80 Flags = flags;
81 MoveType = moveType;
82 }
83
84 std::vector<WaypointNode> Nodes;
85 std::vector<std::pair<std::size_t, std::size_t>> ContinuousSegments;
90
91 void BuildSegments();
92};
93
94#endif
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
uint16 flags
Definition: DisableMgr.cpp:49
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
static constexpr std::size_t WAYPOINT_PATH_FLAG_FOLLOW_PATH_BACKWARDS_MINIMUM_NODES
DEFINE_ENUM_FLAG(WaypointPathFlags)
WaypointMoveType
WaypointPathFlags
@ FollowPathBackwardsFromEndToStart
Optional< Milliseconds > Delay
Optional< float > Orientation
WaypointMoveType MoveType
constexpr WaypointNode(uint32 id, float x, float y, float z, Optional< float > orientation={ }, Optional< Milliseconds > delay={})
constexpr WaypointNode()
std::vector< std::pair< std::size_t, std::size_t > > ContinuousSegments
std::vector< WaypointNode > Nodes
WaypointPath()=default
EnumFlag< WaypointPathFlags > Flags
Optional< float > Velocity
WaypointPath(uint32 id, std::vector< WaypointNode > &&nodes, WaypointMoveType moveType=WaypointMoveType::Walk, WaypointPathFlags flags=WaypointPathFlags::None)
WaypointMoveType MoveType