forked from mirror/DotRecast
Use rented array instead of allocating
(cherry picked from commit ff930712ee
)
This commit is contained in:
parent
7aeb31d369
commit
a7b9b772c4
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -797,7 +797,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