From 9d5abaf14fbeda62609dffce428f1e2753a87b60 Mon Sep 17 00:00:00 2001 From: MaxED Date: Fri, 5 Aug 2016 14:30:10 +0000 Subject: [PATCH] Fixed, map element dragging: in some cases sector properties copied from incorrect sectors were assigned to new sectors when using "Merge Dragged Geometry" mode. --- Source/Core/Map/MapSet.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index 520e55f..bba8ab3 100644 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -2140,8 +2140,24 @@ namespace CodeImp.DoomBuilder.Map // Linedefs cache needs to be up to date... Update(true, false); + // Collect changed lines... We need those in by-vertex-index order + // (otherwise SectorBuilder logic in some cases will incorrectly assign sector propertes) + List markedverts = GetMarkedVertices(true); + List changedlines = new List(markedverts.Count / 2); + HashSet changedlineshash = new HashSet(); + foreach(Vertex v in markedverts) + { + foreach(Linedef l in v.Linedefs) + { + if(!changedlineshash.Contains(l)) + { + changedlines.Add(l); + changedlineshash.Add(l); + } + } + } + // Fix stuff... - List changedlines = LinedefsFromMarkedVertices(false, true, true); CorrectSectorReferences(changedlines, true); CorrectOuterSides(new HashSet(changedlines)); @@ -2354,7 +2370,10 @@ namespace CodeImp.DoomBuilder.Map foreach(Sector s in newsectors) { // Skip if sector already has properties - if(s.CeilTexture != "-") continue; + if(s.CeilTexture != "-" || s.FloorTexture != "-" + || s.FloorHeight != General.Settings.DefaultFloorHeight + || s.CeilHeight != General.Settings.DefaultCeilingHeight) + continue; // Copy from adjacent sector if any if(sector_copy != null)