Fixed, Linedefs mode: linedef selection labels must be updated when performing undo/redo.

Fixed, Things mode: thing selection labels must be updated when performing undo/redo.
Fixed another case of invalid sectors being created after dragging map elements when using "Merge Dragged Geometry" and "Replace with Dragged Geometry" drag modes.
This commit is contained in:
MaxED 2016-09-18 23:46:24 +00:00 committed by spherallic
parent c334888621
commit 838b1dc702
4 changed files with 21 additions and 15 deletions

View file

@ -2407,22 +2407,21 @@ namespace CodeImp.DoomBuilder.Geometry
{
List<LinedefSide> sectorsides = FindPotentialSectorAt(line, front);
if(sectorsides == null) return null;
Sector result = null;
bool foundstartline = false;
// Proceed only if all sectorsides reference the same sector and the start line is among them
// Check potential sectors
foreach(LinedefSide sectorside in sectorsides)
{
Sidedef target = (sectorside.Front ? sectorside.Line.Front : sectorside.Line.Back);
if(target == null) return null; // Fial...
if(result == null) result = target.Sector;
else if(result != target.Sector) return null; // Fial...
if(sectorside.Line == line) foundstartline = true;
if(target != null && target.Sector != null)
{
// Check if target line is inside the found sector
if(target.Sector.Intersect(line.Start.Position, false) && target.Sector.Intersect(line.End.Position, false))
return target.Sector;
}
}
return (foundstartline ? result : null);
// No dice...
return null;
}
#endregion

View file

@ -125,7 +125,7 @@ namespace CodeImp.DoomBuilder.Map
public FlatVertex[] FlatVertices { get { return flatvertices; } }
public ReadOnlyCollection<LabelPositionInfo> Labels { get { return labels; } }
//mxd. Rednering
//mxd. Rendering
public Color4 FogColor { get { return fogcolor; } }
public SectorFogMode FogMode { get { return fogmode; } }
@ -534,7 +534,8 @@ namespace CodeImp.DoomBuilder.Map
// This checks if the given point is inside the sector polygon
// See: http://paulbourke.net/geometry/polygonmesh/index.html#insidepoly
public bool Intersect(Vector2D p)
public bool Intersect(Vector2D p) { return Intersect(p, true); }
public bool Intersect(Vector2D p, bool countontopastrue)
{
//mxd. Check bounding box first
if(p.x < bbox.Left || p.x > bbox.Right || p.y < bbox.Top || p.y > bbox.Bottom) return false;
@ -550,7 +551,7 @@ namespace CodeImp.DoomBuilder.Map
v2 = sd.Line.End.Position;
//mxd. On top of a vertex?
if(p == v1 || p == v2) return true;
if(p == v1 || p == v2) return countontopastrue;
// Check for intersection
if(v1.y != v2.y //mxd. If line is not horizontal...

View file

@ -943,7 +943,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnUndoEnd();
SetupSectorLabels(); // Update sector labels
// Update selection info and labels
UpdateSelectionInfo();
SetupSectorLabels();
}
//mxd
@ -951,7 +953,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnRedoEnd();
SetupSectorLabels(); // Update sector labels
// Update selection info and labels
UpdateSelectionInfo();
SetupSectorLabels();
}
// Mouse moves

View file

@ -588,6 +588,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnUndoEnd();
UpdateSelectionInfo(); // Update selection info and labels
UpdateHelperObjects(); // Update helper lines
SetupSectorLabels(); // And sector labels
}
@ -597,6 +598,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnRedoEnd();
UpdateSelectionInfo(); // Update selection info and labels
UpdateHelperObjects(); // Update helper lines
SetupSectorLabels(); // And sector labels
}