Skip to content

Commit

Permalink
Changed RcLayerRegion.layerId to byte
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Jun 24, 2024
1 parent 35f5c63 commit bdb9463
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/DotRecast.Recast/RcLayerRegion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> layers;
public List<int> neis;
public int ymin, ymax;
public List<int> layers; // Layer count
public List<int> 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<int>();
neis = new List<int>();
ymin = 0xFFFF;
layerId = 0xff;
}
};
}
6 changes: 3 additions & 3 deletions src/DotRecast.Recast/RcLayers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static bool BuildHeightfieldLayers(RcContext ctx, RcCompactHeightfield ch
}

// Create 2D layers from regions.
int layerId = 0;
byte layerId = 0;

List<int> stack = new List<int>();

Expand Down Expand Up @@ -335,7 +335,7 @@ public static bool BuildHeightfieldLayers(RcContext ctx, RcCompactHeightfield ch
if (!ri.@base)
continue;

int newId = ri.layerId;
byte newId = ri.layerId;

for (;;)
{
Expand Down Expand Up @@ -411,7 +411,7 @@ public static bool BuildHeightfieldLayers(RcContext ctx, RcCompactHeightfield ch
}

// Compact layerIds
int[] remap = new int[256];
Span<byte> remap = stackalloc byte[256];

// Find number of unique layers.
layerId = 0;
Expand Down

0 comments on commit bdb9463

Please sign in to comment.