chagned return DtStatus

This commit is contained in:
ikpil 2023-06-17 17:58:58 +09:00
parent c3846198d1
commit 517bb8eb25
2 changed files with 14 additions and 16 deletions

View File

@ -2193,8 +2193,7 @@ namespace DotRecast.Detour
// Validate input // Validate input
if (!m_nav.IsValidPolyRef(startRef) || !RcVec3f.IsFinite(startPos) || !RcVec3f.IsFinite(endPos) if (!m_nav.IsValidPolyRef(startRef) || !RcVec3f.IsFinite(startPos) || !RcVec3f.IsFinite(endPos)
|| null == filter || null == filter || (prevRef != 0 && !m_nav.IsValidPolyRef(prevRef)))
|| (prevRef != 0 && !m_nav.IsValidPolyRef(prevRef)))
{ {
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM; return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
} }

View File

@ -505,9 +505,8 @@ namespace DotRecast.Detour
DtNode next = m_nodePool.GetNodeAtIdx(node.pidx); DtNode next = m_nodePool.GetNodeAtIdx(node.pidx);
if ((node.flags & DtNode.DT_NODE_PARENT_DETACHED) != 0) if ((node.flags & DtNode.DT_NODE_PARENT_DETACHED) != 0)
{ {
var status2 = Raycast(node.id, node.pos, next.pos, m_query.filter, 0, 0, var status = Raycast(node.id, node.pos, next.pos, m_query.filter, 0, 0, out var rayHit);
out var rayHit); if (status.Succeeded())
if (status2.Succeeded())
{ {
path.AddRange(rayHit.path); path.AddRange(rayHit.path);
} }
@ -527,11 +526,11 @@ namespace DotRecast.Detour
} while (node != null); } while (node != null);
} }
DtStatus status = m_query.status; DtStatus details = m_query.status;
// Reset query. // Reset query.
m_query = new DtQueryData(); m_query = new DtQueryData();
return Results.Of(status, path); return Results.Of(details, path);
} }
/// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest /// Finalizes and returns the results of an incomplete sliced path query, returning the path to the furthest
@ -603,9 +602,8 @@ namespace DotRecast.Detour
DtNode next = m_nodePool.GetNodeAtIdx(node.pidx); DtNode next = m_nodePool.GetNodeAtIdx(node.pidx);
if ((node.flags & DtNode.DT_NODE_PARENT_DETACHED) != 0) if ((node.flags & DtNode.DT_NODE_PARENT_DETACHED) != 0)
{ {
var status2 = Raycast(node.id, node.pos, next.pos, m_query.filter, 0, 0, var status = Raycast(node.id, node.pos, next.pos, m_query.filter, 0, 0, out var rayHit);
out var rayHit); if (status.Succeeded())
if (status2.Succeeded())
{ {
path.AddRange(rayHit.path); path.AddRange(rayHit.path);
} }
@ -625,11 +623,12 @@ namespace DotRecast.Detour
} while (node != null); } while (node != null);
} }
DtStatus status = m_query.status; DtStatus details = m_query.status;
// Reset query. // Reset query.
m_query = new DtQueryData(); m_query = new DtQueryData();
return Results.Of(status, path); return Results.Of(details, path);
} }
public override Result<FindDistanceToWallResult> FindDistanceToWall(long startRef, RcVec3f centerPos, float maxRadius, IDtQueryFilter filter) public override Result<FindDistanceToWallResult> FindDistanceToWall(long startRef, RcVec3f centerPos, float maxRadius, IDtQueryFilter filter)