Unfreeze arrays when stitching geometry fails

This commit is contained in:
spherallic 2023-05-07 23:23:33 +02:00
parent 28aa7e4481
commit 2f407b585c

View file

@ -2103,23 +2103,37 @@ namespace CodeImp.DoomBuilder.Map
// Split moving lines with unselected vertices // Split moving lines with unselected vertices
ICollection<Vertex> nearbyfixedverts = FilterByArea(fixedverts, ref editarea); ICollection<Vertex> nearbyfixedverts = FilterByArea(fixedverts, ref editarea);
if(!SplitLinesByVertices(movinglines, nearbyfixedverts, STITCH_DISTANCE, movinglines, mergemode)) if (!SplitLinesByVertices(movinglines, nearbyfixedverts, STITCH_DISTANCE, movinglines, mergemode))
{
EndAddRemove(); // Unfreeze arrays before returning
return false; return false;
}
// Split non-moving lines with selected vertices // Split non-moving lines with selected vertices
fixedlines = FilterByArea(fixedlines, ref editarea); fixedlines = FilterByArea(fixedlines, ref editarea);
fixedlines = new HashSet<Linedef>(fixedlines.Where(fixedline => !fixedline.IsDisposed)); fixedlines = new HashSet<Linedef>(fixedlines.Where(fixedline => !fixedline.IsDisposed));
if(!SplitLinesByVertices(fixedlines, movingverts, STITCH_DISTANCE, movinglines, mergemode)) if (!SplitLinesByVertices(fixedlines, movingverts, STITCH_DISTANCE, movinglines, mergemode))
{
EndAddRemove(); // Unfreeze arrays before returning
return false; return false;
}
//mxd. Split moving lines with fixed lines //mxd. Split moving lines with fixed lines
if(!SplitLinesByLines(fixedlines, movinglines, mergemode)) return false; if (!SplitLinesByLines(fixedlines, movinglines, mergemode))
{
EndAddRemove(); // Unfreeze arrays before returning
return false;
}
// Remove looped linedefs // Remove looped linedefs
RemoveLoopedLinedefs(movinglines); RemoveLoopedLinedefs(movinglines);
// Join overlapping lines // Join overlapping lines
if(!JoinOverlappingLines(movinglines)) return false; if (!JoinOverlappingLines(movinglines))
{
EndAddRemove(); // Unfreeze arrays before returning
return false;
}
//mxd. Remove remaining new verts from dragged shape if possible //mxd. Remove remaining new verts from dragged shape if possible
if(mergemode == MergeGeometryMode.REPLACE) if(mergemode == MergeGeometryMode.REPLACE)