Fixed, Visual mode: fixed another case of sector effects over-updating each other.

This commit is contained in:
MaxED 2016-02-15 18:53:56 +00:00
parent 4ec6aa281d
commit 4666f54957
3 changed files with 47 additions and 10 deletions

View file

@ -494,6 +494,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This updates the VisualSectors and VisualThings that have their Changed property set // This updates the VisualSectors and VisualThings that have their Changed property set
private void UpdateChangedObjects() 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<Sector, VisualSector> vs in allsectors) foreach(KeyValuePair<Sector, VisualSector> vs in allsectors)
{ {
if(vs.Value != null) if(vs.Value != null)
@ -1301,7 +1306,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(s.Marked) if(s.Marked)
{ {
SectorData sd = GetSectorData(s); SectorData sd = GetSectorData(s);
sd.Reset(); sd.Reset(false); //mxd (changed Reset implementation)
// UpdateSectorGeometry for associated sectors (sd.UpdateAlso) as well! // UpdateSectorGeometry for associated sectors (sd.UpdateAlso) as well!
foreach(KeyValuePair<Sector, bool> us in sd.UpdateAlso) foreach(KeyValuePair<Sector, bool> us in sd.UpdateAlso)

View file

@ -121,16 +121,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
changed = true; changed = true;
// Not sure what from this part we need, so commented out for now // Not sure what from this part we need, so commented out for now
SectorData data = GetSectorData(); SectorData data = mode.GetSectorDataEx(this.Sector); //mxd
data.Reset(); if(data != null) //mxd
// Update sectors that rely on this sector
foreach(KeyValuePair<Sector, bool> s in data.UpdateAlso)
{ {
if(mode.VisualSectorExists(s.Key)) data.Reset(includeneighbours);
// Update sectors that rely on this sector
foreach(KeyValuePair<Sector, bool> s in data.UpdateAlso)
{ {
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key); if(mode.VisualSectorExists(s.Key))
vs.Changed = true; {
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(s.Key);
vs.Changed = true;
}
} }
} }

View file

@ -210,7 +210,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// This resets this sector data and all sectors that require updating after me // This resets this sector data and all sectors that require updating after me
public void Reset() /*public void Reset()
{ {
if(isupdating) return; if(isupdating) return;
isupdating = true; isupdating = true;
@ -232,6 +232,35 @@ namespace CodeImp.DoomBuilder.BuilderModes
sd.Reset(); 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<Sector, bool> s in updatesectors)
{
SectorData sd = mode.GetSectorDataEx(s.Key);
if(sd != null) sd.Reset(s.Value);
}
}
isupdating = false; isupdating = false;
} }