From 35f5c63d776d9624775e1e4be4c64c8df6b135ff Mon Sep 17 00:00:00 2001 From: ikpil Date: Tue, 25 Jun 2024 00:17:07 +0900 Subject: [PATCH] DtStraightPathFlags int to byte --- src/DotRecast.Detour/DtNavMeshQuery.cs | 6 +++--- src/DotRecast.Detour/DtStraightPath.cs | 9 +++++++-- src/DotRecast.Detour/DtStraightPathFlags.cs | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/DotRecast.Detour/DtNavMeshQuery.cs b/src/DotRecast.Detour/DtNavMeshQuery.cs index 1742472..1fd20c1 100644 --- a/src/DotRecast.Detour/DtNavMeshQuery.cs +++ b/src/DotRecast.Detour/DtNavMeshQuery.cs @@ -1477,7 +1477,7 @@ namespace DotRecast.Detour return DtStatus.DT_SUCCESS | details; } - protected DtStatus AppendVertex(RcVec3f pos, int flags, long refs, Span straightPath, ref int straightPathCount, int maxStraightPath) + protected DtStatus AppendVertex(RcVec3f pos, byte flags, long refs, Span straightPath, ref int straightPathCount, int maxStraightPath) { if (straightPathCount > 0 && RcVec.Equal(straightPath[straightPathCount - 1].pos, pos)) { @@ -1715,7 +1715,7 @@ namespace DotRecast.Detour portalApex = portalLeft; apexIndex = leftIndex; - int flags = 0; + byte flags = 0; if (leftPolyRef == 0) { flags = DtStraightPathFlags.DT_STRAIGHTPATH_END; @@ -1771,7 +1771,7 @@ namespace DotRecast.Detour portalApex = portalRight; apexIndex = rightIndex; - int flags = 0; + byte flags = 0; if (rightPolyRef == 0) { flags = DtStraightPathFlags.DT_STRAIGHTPATH_END; diff --git a/src/DotRecast.Detour/DtStraightPath.cs b/src/DotRecast.Detour/DtStraightPath.cs index f51c5f3..5bb9116 100644 --- a/src/DotRecast.Detour/DtStraightPath.cs +++ b/src/DotRecast.Detour/DtStraightPath.cs @@ -25,11 +25,16 @@ namespace DotRecast.Detour //TODO: (PP) Add comments public readonly struct DtStraightPath { + /// The local path corridor corners for the agent. (Staight path.) [(x, y, z) * #ncorners] public readonly RcVec3f pos; - public readonly int flags; + + /// The local path corridor corner flags. (See: #dtStraightPathFlags) [(flags) * #ncorners] + public readonly byte flags; + + /// The reference id of the polygon being entered at the corner. [(polyRef) * #ncorners] public readonly long refs; - public DtStraightPath(RcVec3f pos, int flags, long refs) + public DtStraightPath(RcVec3f pos, byte flags, long refs) { this.pos = pos; this.flags = flags; diff --git a/src/DotRecast.Detour/DtStraightPathFlags.cs b/src/DotRecast.Detour/DtStraightPathFlags.cs index a0ea3a3..2d867c4 100644 --- a/src/DotRecast.Detour/DtStraightPathFlags.cs +++ b/src/DotRecast.Detour/DtStraightPathFlags.cs @@ -3,8 +3,8 @@ /// Vertex flags returned by dtNavMeshQuery::findStraightPath. public static class DtStraightPathFlags { - public const int DT_STRAIGHTPATH_START = 0x01; //< The vertex is the start position in the path. - public const int DT_STRAIGHTPATH_END = 0x02; //< The vertex is the end position in the path. - public const int DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04; //< The vertex is the start of an off-mesh connection. + public const byte DT_STRAIGHTPATH_START = 0x01; //< The vertex is the start position in the path. + public const byte DT_STRAIGHTPATH_END = 0x02; //< The vertex is the end position in the path. + public const byte DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04; //< The vertex is the start of an off-mesh connection. } } \ No newline at end of file