From d3aa9c6af17a077dcd0f26f154089232f6808bed Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 11 Nov 2018 10:08:13 +0100 Subject: [PATCH] - do not abort on unclosed sections. Apparently they can indeed happen with broken map setups like isolated linedefs somewhere in the wild (see Strife MAP08.) Although they are a problem for triangulation, this isn't what sections get used for currently so it's of no real concern. In case this is needed later their work data gets marked as 'bad' for the time being. --- src/r_data/r_sections.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/r_data/r_sections.cpp b/src/r_data/r_sections.cpp index 5be657c25..74b89f9a5 100644 --- a/src/r_data/r_sections.cpp +++ b/src/r_data/r_sections.cpp @@ -64,6 +64,7 @@ struct WorkSection int sectorindex; int mapsection; bool hasminisegs; + bool bad; // Did not produce a proper area and cannot be triangulated by tesselation. TArraysegments; TArray originalSides; // The segs will lose some of these while working on them. TArray subsectors; @@ -307,6 +308,7 @@ public: TArray outersegs; TArray loopedsegs; bool hasminisegs = false; + bool bad = false; // Collect all the segs that make up the outline of this section. for (auto j : rawsection) @@ -397,7 +399,8 @@ public: { // Did not find another one but have an unclosed loop. This should never happen and would indicate broken nodes. // Error out and let the calling code deal with it. - I_Error("Unclosed loop in sector %d at position (%d, %d)\n", loopedsegs[0]->Subsector->render_sector->Index(), (int)loopedsegs[0]->v1->fX(), (int)loopedsegs[0]->v1->fY()); + DPrintf(DMSG_NOTIFY, "Unclosed loop in sector %d at position (%d, %d)\n", loopedsegs[0]->Subsector->render_sector->Index(), (int)loopedsegs[0]->v1->fX(), (int)loopedsegs[0]->v1->fY()); + bad = true; } seg = nullptr; loopedsegs.Push(nullptr); // A separator is not really needed but useful for debugging. @@ -428,6 +431,7 @@ public: section.sectorindex = sector; section.mapsection = mapsec; section.hasminisegs = hasminisegs; + section.bad = bad; section.originalSides = std::move(foundsides); section.segments = std::move(sectionlines); section.subsectors = std::move(rawsection);