Fix classic merging mode having incorrect sector references

This commit is contained in:
spherallic 2024-06-21 23:35:33 +02:00
parent 41bb7c0d87
commit 14646d9f35
2 changed files with 5 additions and 3 deletions

View file

@ -1402,6 +1402,7 @@ namespace CodeImp.DoomBuilder.Geometry
// Before this point, the new geometry is not linked with the existing geometry.
// Now perform standard geometry stitching to merge the new geometry with the rest
// of the map. The marked vertices indicate the new geometry.
// TODO: figure out why this specific call requires NOT updating sector references
if (!map.StitchGeometry())
return false;
map.Update(true, false);

View file

@ -2182,8 +2182,9 @@ namespace CodeImp.DoomBuilder.Map
/// <summary>
/// Stitches marked geometry with non-marked geometry. Returns false when the operation failed.
/// </summary>
public bool StitchGeometry() { return StitchGeometry(MergeGeometryMode.CLASSIC); } //mxd. Compatibility
public bool StitchGeometry(MergeGeometryMode mergemode)
public bool StitchGeometry() { return StitchGeometry(MergeGeometryMode.CLASSIC, false); } //mxd. Compatibility TODO: figure out why this is needed and kill it
public bool StitchGeometry(MergeGeometryMode mergemode) { return StitchGeometry(mergemode, true); } //sphere: Compatibility
public bool StitchGeometry(MergeGeometryMode mergemode, bool fixsectors)
{
// Find vertices
HashSet<Vertex> movingverts = new HashSet<Vertex>(General.Map.Map.GetMarkedVertices(true));
@ -2292,7 +2293,7 @@ namespace CodeImp.DoomBuilder.Map
}
//mxd. Correct sector references
if(mergemode != MergeGeometryMode.CLASSIC)
if (fixsectors)
{
// Linedefs cache needs to be up to date...
Update(true, false);