mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-10 17:51:17 +00:00
Fixed: SplitLinesByVertices could leave disposed lines for iteration, which resulted in crashes on certain geometry while using 'Replace with Dragged Geometry'.
This commit is contained in:
parent
03a1d26302
commit
12ea1aa313
1 changed files with 23 additions and 13 deletions
|
@ -2107,7 +2107,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
return false;
|
||||
|
||||
// Split non-moving lines with selected vertices
|
||||
fixedlines = FilterByArea(fixedlines, ref editarea);
|
||||
fixedlines = new HashSet<Linedef>(fixedlines.Where(fixedline => !fixedline.IsDisposed));
|
||||
if(!SplitLinesByVertices(fixedlines, movingverts, STITCH_DISTANCE, movinglines, mergemode))
|
||||
return false;
|
||||
|
||||
|
@ -2352,6 +2352,8 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
LinedefSide ls = edges[i];
|
||||
if (ls.Ignore || ls.Line == null) continue;
|
||||
if (ls.Line.Start == null || ls.Line.End == null)
|
||||
throw new Exception("ls line is null");
|
||||
|
||||
if(ls.Front)
|
||||
{
|
||||
|
@ -3077,11 +3079,19 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
}
|
||||
|
||||
// [ZZ] note: disposing a vertex means also disposing all attached linedefs!
|
||||
// we need to iterate through our lines collection and make sure no disposed linedefs exist there.
|
||||
// also, just in case, do it for vertices as well, because vertices can be chain-disposed.
|
||||
foreach (Linedef line in lines.Where(line => line.IsDisposed).ToList())
|
||||
while (lines.Remove(line));
|
||||
foreach (Vertex vert in verts.Where(vert => vert.IsDisposed).ToList())
|
||||
while (verts.Remove(vert));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Splits lines by lines. Adds new lines to the second collection. Returns false when the operation failed.</summary>
|
||||
public static bool SplitLinesByLines(HashSet<Linedef> lines, HashSet<Linedef> changedlines, MergeGeometryMode mergemode) //mxd
|
||||
public static bool SplitLinesByLines(ICollection<Linedef> lines, HashSet<Linedef> changedlines, MergeGeometryMode mergemode) //mxd
|
||||
{
|
||||
if(lines.Count == 0 || changedlines.Count == 0 || mergemode == MergeGeometryMode.CLASSIC) return true;
|
||||
|
||||
|
|
Loading…
Reference in a new issue