forked from mirror/DotRecast
MergeCorridorStartShortcut alloc fix
This commit is contained in:
parent
4dee6b20b5
commit
05613f196f
|
@ -276,12 +276,15 @@ namespace DotRecast.Detour
|
||||||
// Concatenate paths.
|
// Concatenate paths.
|
||||||
|
|
||||||
// Adjust beginning of the buffer to include the visited.
|
// Adjust beginning of the buffer to include the visited.
|
||||||
List<long> result = visited.GetRange(0, furthestVisited);
|
var length1 = furthestVisited;
|
||||||
result.AddRange(path.GetRange(furthestPath, npath - furthestPath));
|
var length2 = npath - furthestPath;
|
||||||
|
using var result = RcRentedArray.Rent<long>(length1 + length2);
|
||||||
|
visited.CopyTo(0, result.AsArray(), 0, length1);
|
||||||
|
path.CopyTo(furthestPath, result.AsArray(), length1, length2);
|
||||||
|
|
||||||
path.Clear();
|
path.Clear();
|
||||||
path.AddRange(result);
|
CollectionExtensions.AddRange(path, result.AsSpan());
|
||||||
return result.Count;
|
return result.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue