forked from mirror/DotRecast
Use rented array instead of allocating
This commit is contained in:
parent
6fe6844efd
commit
ff930712ee
|
@ -1365,6 +1365,11 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetTilesAt(int x, int y, DtMeshTile[] tiles, int maxTiles)
|
public int GetTilesAt(int x, int y, DtMeshTile[] tiles, int maxTiles)
|
||||||
|
{
|
||||||
|
return GetTilesAt(x, y, (Span<DtMeshTile>)tiles, maxTiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetTilesAt(int x, int y, Span<DtMeshTile> tiles, int maxTiles)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
|
|
|
@ -788,7 +788,8 @@ namespace DotRecast.Detour
|
||||||
m_nav.CalcTileLoc(bmax, out var maxx, out var maxy);
|
m_nav.CalcTileLoc(bmax, out var maxx, out var maxy);
|
||||||
|
|
||||||
const int MAX_NEIS = 32;
|
const int MAX_NEIS = 32;
|
||||||
DtMeshTile[] neis = new DtMeshTile[MAX_NEIS];
|
using RcRentedArray<DtMeshTile> neisRent = RcRentedArray.Rent<DtMeshTile>(MAX_NEIS);
|
||||||
|
Span<DtMeshTile> neis = neisRent.AsSpan();
|
||||||
|
|
||||||
for (int y = miny; y <= maxy; ++y)
|
for (int y = miny; y <= maxy; ++y)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue