m_npath instead of m_path.Count

This commit is contained in:
ikpil 2024-05-07 23:56:15 +09:00
parent fc673b2c25
commit 19e358bdfc
1 changed files with 13 additions and 13 deletions

View File

@ -238,7 +238,7 @@ namespace DotRecast.Detour.Crowd
/// @param[in] filter The filter to apply to the operation.
public bool OptimizePathTopology(DtNavMeshQuery navquery, IDtQueryFilter filter, int maxIterations)
{
if (m_path.Count < 3)
if (m_npath < 3)
{
return false;
}
@ -262,21 +262,21 @@ namespace DotRecast.Detour.Crowd
// Advance the path up to and over the off-mesh connection.
long prevRef = 0, polyRef = m_path[0];
int npos = 0;
while (npos < m_path.Count && polyRef != offMeshConRef)
while (npos < m_npath && polyRef != offMeshConRef)
{
prevRef = polyRef;
polyRef = m_path[npos];
npos++;
}
if (npos == m_path.Count)
if (npos == m_npath)
{
// Could not find offMeshConRef
return false;
}
// Prune path
m_path = m_path.GetRange(npos, m_path.Count - npos);
m_path = m_path.GetRange(npos, m_npath - npos);
m_npath -= npos;
refs[0] = prevRef;
@ -398,7 +398,7 @@ namespace DotRecast.Detour.Crowd
public void FixPathStart(long safeRef, RcVec3f safePos)
{
m_pos = safePos;
if (m_path.Count < 3 && m_path.Count > 0)
if (m_npath < 3 && m_npath > 0)
{
long p = m_path[m_npath - 1];
m_path.Clear();
@ -420,12 +420,12 @@ namespace DotRecast.Detour.Crowd
{
// Keep valid path as far as possible.
int n = 0;
while (n < m_path.Count && navquery.IsValidPolyRef(m_path[n], filter))
while (n < m_npath && navquery.IsValidPolyRef(m_path[n], filter))
{
n++;
}
if (m_path.Count == n)
if (m_npath == n)
{
// All valid, no need to fix.
return true;
@ -438,7 +438,7 @@ namespace DotRecast.Detour.Crowd
m_path.Add(safeRef);
m_npath = 1;
}
else if (n < m_path.Count)
else if (n < m_npath)
{
// The path is partially usable.
m_path = m_path.GetRange(0, n);
@ -446,7 +446,7 @@ namespace DotRecast.Detour.Crowd
}
// Clamp target pos to last poly
navquery.ClosestPointOnPolyBoundary(m_path[m_path.Count - 1], m_target, out m_target);
navquery.ClosestPointOnPolyBoundary(m_path[m_npath - 1], m_target, out m_target);
return true;
}
@ -462,7 +462,7 @@ namespace DotRecast.Detour.Crowd
public bool IsValid(int maxLookAhead, DtNavMeshQuery navquery, IDtQueryFilter filter)
{
// Check that all polygons still pass query filter.
int n = Math.Min(m_path.Count, maxLookAhead);
int n = Math.Min(m_npath, maxLookAhead);
for (int i = 0; i < n; ++i)
{
if (!navquery.IsValidPolyRef(m_path[i], filter))
@ -492,14 +492,14 @@ namespace DotRecast.Detour.Crowd
/// @return The polygon reference id of the first polygon in the corridor. (Or zero if there is no path.)
public long GetFirstPoly()
{
return 0 == m_path.Count ? 0 : m_path[0];
return 0 == m_npath ? 0 : m_path[0];
}
/// The polygon reference id of the last polygon in the corridor, the polygon containing the target.
/// @return The polygon reference id of the last polygon in the corridor. (Or zero if there is no path.)
public long GetLastPoly()
{
return 0 == m_path.Count ? 0 : m_path[m_path.Count - 1];
return 0 == m_npath ? 0 : m_path[m_npath - 1];
}
/// The corridor's path.
@ -513,7 +513,7 @@ namespace DotRecast.Detour.Crowd
/// @return The number of polygons in the current corridor path.
public int GetPathCount()
{
return m_path.Count;
return m_npath;
}
}
}