From 19003a7973e116e76af0b234a111c30d18e2cfda Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 27 May 2016 09:38:33 +0200 Subject: [PATCH] - fixed: The node builder's FindMapBounds function included all vertices generated by the node builder. This could cause problems on maps with bogus nodes so it's better to only check vertices that are referenced by a linedef. --- src/nodebuild_utility.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/nodebuild_utility.cpp b/src/nodebuild_utility.cpp index f25d747db..02e280261 100644 --- a/src/nodebuild_utility.cpp +++ b/src/nodebuild_utility.cpp @@ -616,12 +616,16 @@ void FNodeBuilder::FLevel::FindMapBounds() minx = maxx = Vertices[0].fX(); miny = maxy = Vertices[0].fY(); - for (int i = 1; i < NumVertices; ++i) + for (int i = 1; i < NumLines; ++i) { - if (Vertices[i].fX() < minx) minx = Vertices[i].fX(); - else if (Vertices[i].fX() > maxx) maxx = Vertices[i].fX(); - if (Vertices[i].fY() < miny) miny = Vertices[i].fY(); - else if (Vertices[i].fY() > maxy) maxy = Vertices[i].fY(); + for (int j = 0; j < 2; j++) + { + vertex_t *v = (j == 0 ? Lines[i].v1 : Lines[i].v2); + if (v->fX() < minx) minx = v->fX(); + else if (v->fX() > maxx) maxx = v->fX(); + if (v->fY() < miny) miny = v->fY(); + else if (v->fY() > maxy) maxy = v->fY(); + } } MinX = FLOAT2FIXED(minx);