Correct sector references when manually flipping sidedefs

This commit is contained in:
spherallic 2023-05-09 20:45:25 +02:00
parent ef557fce7f
commit 79dfafc691
2 changed files with 11 additions and 2 deletions

View file

@ -1014,7 +1014,9 @@ namespace CodeImp.DoomBuilder.Map
}
// This flips the sidedefs
public void FlipSidedefs()
public void FlipSidedefs() { FlipSidedefs(false); }
public void FlipSidedefs(bool flipsectorrefs)
{
// Flip sidedefs
Sidedef oldfront = front;
@ -1022,6 +1024,13 @@ namespace CodeImp.DoomBuilder.Map
AttachFront(oldback);
AttachBack(oldfront);
if (flipsectorrefs & back != null)
{
Sector old = back.Sector;
back.SetSector(front.Sector);
front.SetSector(old);
}
General.Map.IsChanged = true;
}

View file

@ -2110,7 +2110,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Flip sidedefs in all selected linedefs
foreach(Linedef l in validlines)
{
l.FlipSidedefs();
l.FlipSidedefs(true);
l.Front.Sector.UpdateNeeded = true;
l.Back.Sector.UpdateNeeded = true;
}