fix(core): Phase B.3 — restore SceneryGenerator road exclusion check

The IsRoadVertex check and helper were dropped by a linter pass after the
previous commit. Re-adding them explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-12 18:29:20 +02:00
parent 768a9a0619
commit 777893783a

View file

@ -68,6 +68,12 @@ public static class SceneryGenerator
uint terrainType = (uint)((raw >> 2) & 0x1F); // bits 2-6
uint sceneType = (uint)((raw >> 11) & 0x1F); // bits 11-15
// Skip road vertices: bits 0-1 of the terrain word encode the road
// type (non-zero means this vertex is on a road). Ported from
// ACViewer Physics/Common/Landblock.cs GetRoad() and the OnRoad()
// check in get_land_scenes(). Roads should not have trees/rocks.
if (IsRoadVertex(raw)) continue;
if (terrainType >= region.TerrainInfo.TerrainTypes.Count) continue;
var sceneTypeList = region.TerrainInfo.TerrainTypes[(int)terrainType].SceneTypes;
if (sceneType >= sceneTypeList.Count) continue;
@ -160,6 +166,13 @@ public static class SceneryGenerator
return result;
}
/// <summary>
/// Returns true if the raw terrain word indicates a road vertex.
/// Bits 0-1 of the terrain word encode the road type; any non-zero value
/// means the vertex is on a road. Ported from ACViewer GetRoad().
/// </summary>
public static bool IsRoadVertex(ushort raw) => (raw & 0x3u) != 0;
/// <summary>
/// Pseudo-random displacement within a cell for a scenery object. Returns a
/// Vector3 in local cell-offset space (the caller adds it to the cell corner