diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index d353e5b6..ffbdf049 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -494,6 +494,11 @@ namespace CodeImp.DoomBuilder.BuilderModes // This updates the VisualSectors and VisualThings that have their Changed property set private void UpdateChangedObjects() { + //mxd + SectorData[] toupdate = new SectorData[sectordata.Values.Count]; + sectordata.Values.CopyTo(toupdate, 0); + foreach(SectorData data in toupdate) data.Update(); + foreach(KeyValuePair vs in allsectors) { if(vs.Value != null) @@ -1301,7 +1306,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(s.Marked) { SectorData sd = GetSectorData(s); - sd.Reset(); + sd.Reset(false); //mxd (changed Reset implementation) // UpdateSectorGeometry for associated sectors (sd.UpdateAlso) as well! foreach(KeyValuePair us in sd.UpdateAlso) diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs index 7a8730a5..0147ecc2 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualSector.cs @@ -121,16 +121,19 @@ namespace CodeImp.DoomBuilder.BuilderModes changed = true; // Not sure what from this part we need, so commented out for now - SectorData data = GetSectorData(); - data.Reset(); - - // Update sectors that rely on this sector - foreach(KeyValuePair s in data.UpdateAlso) + SectorData data = mode.GetSectorDataEx(this.Sector); //mxd + if(data != null) //mxd { - if(mode.VisualSectorExists(s.Key)) + data.Reset(includeneighbours); + + // Update sectors that rely on this sector + foreach(KeyValuePair s in data.UpdateAlso) { - BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key); - vs.Changed = true; + if(mode.VisualSectorExists(s.Key)) + { + BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key); + vs.Changed = true; + } } } diff --git a/Source/Plugins/BuilderModes/VisualModes/SectorData.cs b/Source/Plugins/BuilderModes/VisualModes/SectorData.cs index 62ee0f7c..05b6e98f 100644 --- a/Source/Plugins/BuilderModes/VisualModes/SectorData.cs +++ b/Source/Plugins/BuilderModes/VisualModes/SectorData.cs @@ -210,7 +210,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } // This resets this sector data and all sectors that require updating after me - public void Reset() + /*public void Reset() { if(isupdating) return; isupdating = true; @@ -232,6 +232,35 @@ namespace CodeImp.DoomBuilder.BuilderModes sd.Reset(); } + isupdating = false; + }*/ + + //mxd. This marks this sector data and all sector datas that require updating as not updated + public void Reset(bool resetneighbours) + { + if(isupdating) return; + isupdating = true; + + // This is set to false so that this sector is rebuilt the next time it is needed! + updated = false; + + // The visual sector associated is now outdated + if(mode.VisualSectorExists(sector)) + { + BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(sector); + vs.Changed = true; + } + + // Reset the sectors that depend on this sector + if(resetneighbours) + { + foreach(KeyValuePair s in updatesectors) + { + SectorData sd = mode.GetSectorDataEx(s.Key); + if(sd != null) sd.Reset(s.Value); + } + } + isupdating = false; }