update comment, class member name

This commit is contained in:
ikpil 2024-05-12 00:36:18 +09:00
parent 61e7b7a443
commit 3f750ba499
1 changed files with 17 additions and 19 deletions

View File

@ -68,16 +68,14 @@ namespace DotRecast.Detour
private readonly DtNavMeshParams m_params; //< Current initialization params. TODO: do not store this info twice. private readonly DtNavMeshParams m_params; //< Current initialization params. TODO: do not store this info twice.
private readonly RcVec3f m_orig; // < Origin of the tile (0,0) private readonly RcVec3f m_orig; // < Origin of the tile (0,0)
// float m_orig[3]; ///< Origin of the tile (0,0) private readonly float m_tileWidth;// < Dimensions of each tile.
private readonly float m_tileHeight; // < Dimensions of each tile.
private float m_tileWidth; private readonly int m_maxTiles; // < Max number of tiles.
private float m_tileHeight; // < Dimensions of each tile.
int m_maxTiles; // < Max number of tiles.
private readonly int m_tileLutMask; // < Tile hash lookup mask. private readonly int m_tileLutMask; // < Tile hash lookup mask.
private readonly Dictionary<int, List<DtMeshTile>> posLookup = new Dictionary<int, List<DtMeshTile>>();
private readonly LinkedList<DtMeshTile> availableTiles = new LinkedList<DtMeshTile>(); private readonly Dictionary<int, List<DtMeshTile>> m_posLookup = new Dictionary<int, List<DtMeshTile>>(); //< Tile hash lookup.
private readonly DtMeshTile[] m_tiles; // List of tiles. private readonly LinkedList<DtMeshTile> m_nextFree = new LinkedList<DtMeshTile>(); //< Freelist of tiles.
private readonly DtMeshTile[] m_tiles; //< List of tiles.
/** The maximum number of vertices per navigation polygon. */ /** The maximum number of vertices per navigation polygon. */
private readonly int m_maxVertPerPoly; private readonly int m_maxVertPerPoly;
@ -105,7 +103,7 @@ namespace DotRecast.Detour
{ {
m_tiles[i] = new DtMeshTile(i); m_tiles[i] = new DtMeshTile(i);
m_tiles[i].salt = 1; m_tiles[i].salt = 1;
availableTiles.AddLast(m_tiles[i]); m_nextFree.AddLast(m_tiles[i]);
} }
} }
@ -475,13 +473,13 @@ namespace DotRecast.Detour
if (lastRef == 0) if (lastRef == 0)
{ {
// Make sure we could allocate a tile. // Make sure we could allocate a tile.
if (0 == availableTiles.Count) if (0 == m_nextFree.Count)
{ {
throw new Exception("Could not allocate a tile"); throw new Exception("Could not allocate a tile");
} }
tile = availableTiles.First?.Value; tile = m_nextFree.First?.Value;
availableTiles.RemoveFirst(); m_nextFree.RemoveFirst();
m_tileCount++; m_tileCount++;
} }
else else
@ -496,7 +494,7 @@ namespace DotRecast.Detour
// Try to find the specific tile id from the free list. // Try to find the specific tile id from the free list.
DtMeshTile target = m_tiles[tileIndex]; DtMeshTile target = m_tiles[tileIndex];
// Remove from freelist // Remove from freelist
if (!availableTiles.Remove(target)) if (!m_nextFree.Remove(target))
{ {
// Could not find the correct location. // Could not find the correct location.
throw new Exception("Could not find tile"); throw new Exception("Could not find tile");
@ -634,7 +632,7 @@ namespace DotRecast.Detour
} }
// Add to free list. // Add to free list.
availableTiles.AddFirst(tile); m_nextFree.AddFirst(tile);
m_tileCount--; m_tileCount--;
return GetTileRef(tile); return GetTileRef(tile);
} }
@ -1589,7 +1587,7 @@ namespace DotRecast.Detour
public int GetAvailableTileCount() public int GetAvailableTileCount()
{ {
return availableTiles.Count; return m_nextFree.Count;
} }
public DtStatus SetPolyFlags(long refs, int flags) public DtStatus SetPolyFlags(long refs, int flags)
@ -1764,10 +1762,10 @@ namespace DotRecast.Detour
private List<DtMeshTile> GetTileListByPos(int x, int z) private List<DtMeshTile> GetTileListByPos(int x, int z)
{ {
var tileHash = ComputeTileHash(x, z, m_tileLutMask); var tileHash = ComputeTileHash(x, z, m_tileLutMask);
if (!posLookup.TryGetValue(tileHash, out var tiles)) if (!m_posLookup.TryGetValue(tileHash, out var tiles))
{ {
tiles = new List<DtMeshTile>(); tiles = new List<DtMeshTile>();
posLookup.Add(tileHash, tiles); m_posLookup.Add(tileHash, tiles);
} }
return tiles; return tiles;