From 387a03c7eec8d51d0737888e7db6c835b46ac312 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 12 Dec 2021 00:22:07 +0100 Subject: [PATCH] - fixed triangulation via node builder for sectors with invalid walls. The array indices were not properly adjusted for the missing elements an --- source/core/sectorgeometry.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index 4045f2a8b..40fad04d2 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -363,15 +363,17 @@ bool SectorGeometry::MakeVertices2(unsigned int secnum, int plane, const FVector lines[j].wallnum = sline->wall; lines[j].sidedef[0] = &sides[j]; lines[j].sidedef[1] = nullptr; - lines[j].v1 = &vertexes[i]; - lines[j].v2 = &vertexes[sline->point2index]; + lines[j].v1 = &vertexes[j]; + lines[j].v2 = &vertexes[sline->point2index + j - i]; sides[j].sidenum = j; sides[j].sector = sectorp; j++; } - lines.Resize(j); - sides.Resize(j); + + vertexes.Clamp(j); + lines.Clamp(j); + sides.Clamp(j); // Weed out any overlaps. These often happen with door setups and can lead to bad subsectors for (unsigned i = 0; i < lines.Size(); i++) {