Fixed, map element dragging: in some cases sector properties copied from incorrect sectors were assigned to new sectors when using "Merge Dragged Geometry" mode.

This commit is contained in:
MaxED 2016-08-05 14:30:10 +00:00 committed by spherallic
parent ead65ebd93
commit 9d5abaf14f

View file

@ -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<Vertex> markedverts = GetMarkedVertices(true);
List<Linedef> changedlines = new List<Linedef>(markedverts.Count / 2);
HashSet<Linedef> changedlineshash = new HashSet<Linedef>();
foreach(Vertex v in markedverts)
{
foreach(Linedef l in v.Linedefs)
{
if(!changedlineshash.Contains(l))
{
changedlines.Add(l);
changedlineshash.Add(l);
}
}
}
// Fix stuff...
List<Linedef> changedlines = LinedefsFromMarkedVertices(false, true, true);
CorrectSectorReferences(changedlines, true);
CorrectOuterSides(new HashSet<Linedef>(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)