From bdb9463d88a0ea645c61489c07f82a8457e122b0 Mon Sep 17 00:00:00 2001 From: ikpil Date: Tue, 25 Jun 2024 00:30:51 +0900 Subject: [PATCH] Changed RcLayerRegion.layerId to byte --- src/DotRecast.Recast/RcLayerRegion.cs | 16 ++++++++-------- src/DotRecast.Recast/RcLayers.cs | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/DotRecast.Recast/RcLayerRegion.cs b/src/DotRecast.Recast/RcLayerRegion.cs index 7c94007..dc98ecb 100644 --- a/src/DotRecast.Recast/RcLayerRegion.cs +++ b/src/DotRecast.Recast/RcLayerRegion.cs @@ -4,20 +4,20 @@ namespace DotRecast.Recast { public class RcLayerRegion { - public int id; - public int layerId; // Layer ID - public bool @base; // Flag indicating if the region is the base of merged regions. + public readonly int index; + public List layers; + public List neis; public int ymin, ymax; - public List layers; // Layer count - public List neis; // Neighbour count + public byte layerId; // Layer ID + public bool @base; // Flag indicating if the region is the base of merged regions. public RcLayerRegion(int i) { - id = i; - ymin = 0xFFFF; - layerId = 0xff; + index = i; layers = new List(); neis = new List(); + ymin = 0xFFFF; + layerId = 0xff; } }; } \ No newline at end of file diff --git a/src/DotRecast.Recast/RcLayers.cs b/src/DotRecast.Recast/RcLayers.cs index 98cee66..b9a2996 100644 --- a/src/DotRecast.Recast/RcLayers.cs +++ b/src/DotRecast.Recast/RcLayers.cs @@ -266,7 +266,7 @@ namespace DotRecast.Recast } // Create 2D layers from regions. - int layerId = 0; + byte layerId = 0; List stack = new List(); @@ -335,7 +335,7 @@ namespace DotRecast.Recast if (!ri.@base) continue; - int newId = ri.layerId; + byte newId = ri.layerId; for (;;) { @@ -411,7 +411,7 @@ namespace DotRecast.Recast } // Compact layerIds - int[] remap = new int[256]; + Span remap = stackalloc byte[256]; // Find number of unique layers. layerId = 0;