From b1f3641f3c1f62a78e2f90794e7818f6ccb788e3 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Fri, 20 Sep 2019 17:30:17 +0200 Subject: [PATCH] Only rebuild changed parts of the blockmap in visual mode --- .../VisualModes/BaseVisualMode.cs | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index f8d9a18..1c2ad76 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -1606,7 +1606,42 @@ namespace CodeImp.DoomBuilder.BuilderModes sd.Sector.Marked = true; // Make new blockmap - FillBlockMap(); + foreach (MapElement e in General.Map.Map.RemovedElements) + { + if (e is Linedef) + blockmap.RemoveLinedef(e as Linedef); + else if (e is Thing) + blockmap.RemoveThing(e as Thing); + else if (e is Sector) + blockmap.RemoveSector(e as Sector); + } + + foreach (Linedef l in General.Map.Map.Linedefs) + { + if (l.Marked) + { + blockmap.RemoveLinedef(l); + blockmap.AddLinedef(l); + } + } + + foreach (Thing t in General.Map.Map.Things) + { + if (t.Marked) + { + blockmap.RemoveThing(t); + blockmap.AddThing(t); + } + } + + foreach (Sector s in General.Map.Map.Sectors) + { + if (s.Marked) + { + blockmap.RemoveSector(s); + blockmap.AddSector(s); + } + } RebuildElementData(true);