mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
fixed bug in vertex Join method: this now also works with attached zero-length linedefs that references the same vertex twice
This commit is contained in:
parent
3c0e66a36e
commit
88d1be35cc
1 changed files with 10 additions and 24 deletions
|
@ -227,34 +227,20 @@ namespace CodeImp.DoomBuilder.Map
|
|||
// Which means this vertex is removed and the other is kept!
|
||||
public void Join(Vertex other)
|
||||
{
|
||||
LinkedListNode<Linedef> previous;
|
||||
LinkedListNode<Linedef> current;
|
||||
|
||||
// Go for all lines
|
||||
current = linedefs.Last;
|
||||
while(current != null)
|
||||
{
|
||||
// Get previous
|
||||
previous = current.Previous;
|
||||
|
||||
// Move the start to the other vertex
|
||||
if(current.Value.Start == this)
|
||||
current.Value.SetStartVertex(other);
|
||||
|
||||
// Move the end to the other vertex
|
||||
if(current.Value.End == this)
|
||||
current.Value.SetEndVertex(other);
|
||||
|
||||
// Go back one
|
||||
current = previous;
|
||||
}
|
||||
|
||||
// If either of the two vertices was selected, keep the other selected
|
||||
if(this.selected) other.selected = true;
|
||||
if(this.marked) other.marked = true;
|
||||
|
||||
// Remove this vertex
|
||||
this.Dispose();
|
||||
// Detach all linedefs
|
||||
// This will automatically dispose this vertex
|
||||
while(linedefs != null)
|
||||
{
|
||||
// Move the line to the other vertex
|
||||
if(linedefs.First.Value.Start == this)
|
||||
linedefs.First.Value.SetStartVertex(other);
|
||||
else
|
||||
linedefs.First.Value.SetEndVertex(other);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue