mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-30 23:52:38 +00:00
48fef89ed7
Map Analysis mode: "Check overlapping lines" now finds duplicate linedefs (e.g. when 2 lines have the same start and end positions). Map Analysis mode: added "Check overlapping vertices" check. This will check if a vertex is on top of a linedef or another vertex. Some cosmetic changes in Tools and BaseVisualMode. Updated zspecial.acs
63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
#region ================== Namespaces
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
{
|
|
public class ResultVertexOverlappingVertex : ErrorResult
|
|
{
|
|
#region ================== Variables
|
|
|
|
private Vertex vertex1;
|
|
private Vertex vertex2;
|
|
|
|
#endregion
|
|
|
|
#region ================== Properties
|
|
|
|
public override int Buttons { get { return 1; } }
|
|
public override string Button1Text { get { return "Merge Vertices"; } }
|
|
|
|
#endregion
|
|
|
|
#region ================== Constructor / Destructor
|
|
|
|
// Constructor
|
|
public ResultVertexOverlappingVertex(Vertex v1, Vertex v2)
|
|
{
|
|
// Initialize
|
|
this.vertex1 = v1;
|
|
this.vertex2 = v2;
|
|
this.viewobjects.Add(v1);
|
|
this.viewobjects.Add(v2);
|
|
this.description = "These vertices have the same position.";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ================== Methods
|
|
|
|
// This must return the string that is displayed in the listbox
|
|
public override string ToString() {
|
|
return "Vertices " + vertex1.Index + " and " + vertex2.Index + " have the same position";
|
|
}
|
|
|
|
// Rendering
|
|
public override void PlotSelection(IRenderer2D renderer) {
|
|
renderer.PlotVertex(vertex1, ColorCollection.SELECTION);
|
|
}
|
|
|
|
// Fix by splitting the line
|
|
public override bool Button1Click(bool batchMode) {
|
|
if(!batchMode) General.Map.UndoRedo.CreateUndo("Merge vertices");
|
|
vertex2.Join(vertex1);
|
|
General.Map.Map.Update();
|
|
return true;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|