Simplify some loops

This commit is contained in:
Jarrod Doyle 2024-10-27 08:57:59 +00:00
parent 3df1b728e6
commit 0a41d78cac
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 4 additions and 5 deletions

View File

@ -346,9 +346,8 @@ class Program
var indices = new List<int>();
var cells = worldRep.Cells;
for (var cellIdx = 0; cellIdx < cells.Length; cellIdx++)
foreach (var cell in cells)
{
var cell = cells[cellIdx];
var numPolys = cell.PolyCount;
var numRenderPolys = cell.RenderPolyCount;
var numPortalPolys = cell.PortalPolyCount;
@ -361,7 +360,7 @@ class Program
var maxPolyIdx = Math.Min(numRenderPolys, numPolys - numPortalPolys);
var cellIdxOffset = 0;
for (int polyIdx = 0; polyIdx < maxPolyIdx; polyIdx++)
for (var polyIdx = 0; polyIdx < maxPolyIdx; polyIdx++)
{
var poly = cell.Polys[polyIdx];
@ -373,7 +372,7 @@ class Program
vertices.Add(vertex);
}
for (int j = 1; j < numPolyVertices - 1; j++)
for (var j = 1; j < numPolyVertices - 1; j++)
{
indices.Add(meshIndexOffset);
indices.Add(meshIndexOffset + j);
@ -409,7 +408,7 @@ class Program
var maxPolyIdx = Math.Min(numRenderPolys, numPolys - numPortalPolys);
var cellIdxOffset = 0;
for (int polyIdx = 0; polyIdx < maxPolyIdx; polyIdx++)
for (var polyIdx = 0; polyIdx < maxPolyIdx; polyIdx++)
{
var poly = cell.Polys[polyIdx];
var plane = cell.Planes[poly.PlaneId];