/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ #ifndef TRINITY_WAYPOINTDEFINES_H #define TRINITY_WAYPOINTDEFINES_H #include "Define.h" #include "Duration.h" #include "EnumFlag.h" #include "Optional.h" #include static inline constexpr std::size_t WAYPOINT_PATH_FLAG_FOLLOW_PATH_BACKWARDS_MINIMUM_NODES = 2; enum class WaypointMoveType : uint8 { Walk = 0, Run = 1, Land = 2, TakeOff = 3, Max }; enum class WaypointPathFlags : uint8 { None = 0x00, FollowPathBackwardsFromEndToStart = 0x01, ExactSplinePath = 0x02, // Points are going to be merged into single packets and pathfinding is disabled FlyingPath = ExactSplinePath // flying paths are always exact splines }; DEFINE_ENUM_FLAG(WaypointPathFlags); struct WaypointNode { constexpr WaypointNode() : Id(0), X(0.f), Y(0.f), Z(0.f), MoveType(WaypointMoveType::Walk) { } constexpr WaypointNode(uint32 id, float x, float y, float z, Optional orientation = { }, Optional delay = {}) : Id(id), X(x), Y(y), Z(z), Orientation(orientation), Delay(delay), MoveType(WaypointMoveType::Walk) { } uint32 Id; float X; float Y; float Z; Optional Orientation; Optional Delay; WaypointMoveType MoveType; }; struct WaypointPath { WaypointPath() = default; WaypointPath(uint32 id, std::vector&& nodes, WaypointMoveType moveType = WaypointMoveType::Walk, WaypointPathFlags flags = WaypointPathFlags::None) : Nodes(std::move(nodes)), Id(id), MoveType(moveType), Flags(flags) { } std::vector Nodes; std::vector> ContinuousSegments; uint32 Id = 0; WaypointMoveType MoveType = WaypointMoveType::Walk; EnumFlag Flags = WaypointPathFlags::None; Optional Velocity; void BuildSegments(); }; #endif