- added a workaround for the 'cannot split a seg' error in the node builder: In order to prevent all segs from ending up on the same side it will now force the bogus seg onto the other side of the node - regardless of whether this is correct or not, because the most important thing here is that the set of segs gets split to prevent the node builder from ending up in an endless recursion trying to split the same set of data and endlessly failing.

Note that this is not a fix, it's merely a countermeasure to avoid the crash in ZPack's E2M6 which this seems to achieve.
This commit is contained in:
Christoph Oelckers 2017-02-27 01:41:27 +01:00
parent 1ed2a0baf9
commit c8445703ac

View file

@ -818,11 +818,8 @@ void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &ou
newvert.y += fixed_t(frac * double(Vertices[seg->v2].y - newvert.y));
vertnum = VertexMap->SelectVertexClose (newvert);
if (vertnum == (unsigned int)seg->v1 || vertnum == (unsigned int)seg->v2)
if (vertnum != (unsigned int)seg->v1 && vertnum != (unsigned int)seg->v2)
{
Printf("SelectVertexClose selected endpoint of seg %u\n", set);
}
seg2 = SplitSeg(set, vertnum, sidev[0]);
Segs[seg2].next = outset0;
@ -852,7 +849,26 @@ void FNodeBuilder::SplitSegs (DWORD set, node_t &node, DWORD splitseg, DWORD &ou
{
AddIntersection(node, vertnum);
}
}
else
{
// all that matters here is to prevent a crash so we must make sure that we do not end up with all segs being sorted to the same side - even if this may not be correct.
// But if we do not do that this code would not be able to move on. Just discarding the seg is also not an option because it won't guarantee that we achieve an actual split.
if (_count0 == 0)
{
side = 0;
seg->next = outset0;
outset0 = set;
_count0++;
}
else
{
side = 1;
seg->next = outset1;
outset1 = set;
_count1++;
}
}
break;
}
if (side >= 0 && GLNodes)