mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Sectors Mode: fixed a bug that could cause a crash when drag-selecting over areas that contained sectors after deleting those sectors
This commit is contained in:
parent
f4307a4c64
commit
f097fec1a2
1 changed files with 24 additions and 6 deletions
|
@ -681,6 +681,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a blockmap containing sectors and things. This is used to speed determining which sector a
|
||||
/// thing is in when synchronized thing editing is enabled
|
||||
/// </summary>
|
||||
private void CreateBlockmap()
|
||||
{
|
||||
RectangleF area = MapSet.CreateArea(General.Map.Map.Vertices);
|
||||
area = MapSet.IncreaseArea(area, General.Map.Map.Things);
|
||||
blockmap = new BlockMap<BlockEntry>(area);
|
||||
blockmap.AddSectorsSet(General.Map.Map.Sectors);
|
||||
blockmap.AddThingsSet(General.Map.Map.Things);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
@ -741,13 +754,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
BuilderPlug.Me.MenusForm.SyncronizeThingEditButton.ToolTipText = "Synchronized Things Editing" + Environment.NewLine + BuilderPlug.Me.MenusForm.SyncronizeThingEditSectorsItem.ToolTipText;
|
||||
|
||||
// Create the blockmap
|
||||
RectangleF area = MapSet.CreateArea(General.Map.Map.Vertices);
|
||||
area = MapSet.IncreaseArea(area, General.Map.Map.Things);
|
||||
blockmap = new BlockMap<BlockEntry>(area);
|
||||
blockmap.AddSectorsSet(General.Map.Map.Sectors);
|
||||
blockmap.AddThingsSet(General.Map.Map.Things);
|
||||
CreateBlockmap();
|
||||
|
||||
//mxd. Select things as well?
|
||||
// Select things in the selected sectors if synchronized thing editing is enabled
|
||||
if(BuilderPlug.Me.SyncronizeThingEdit)
|
||||
{
|
||||
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
|
||||
|
@ -1414,6 +1423,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// When undo is performed
|
||||
public override void OnUndoEnd()
|
||||
{
|
||||
// Recreate the blockmap to not include the potentially un-done sectors and things anymore
|
||||
CreateBlockmap();
|
||||
|
||||
// Clear labels
|
||||
SetupLabels();
|
||||
UpdateEffectLabels(); //mxd
|
||||
|
@ -1433,6 +1445,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// When redo is performed
|
||||
public override void OnRedoEnd()
|
||||
{
|
||||
// Recreate the blockmap to include the potentially re-done sectors and things again
|
||||
CreateBlockmap();
|
||||
|
||||
// Clear labels
|
||||
SetupLabels();
|
||||
UpdateEffectLabels(); //mxd
|
||||
|
@ -1952,6 +1967,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
General.Map.Map.EndAddRemove(); //mxd
|
||||
|
||||
// Recreate the blockmap since it shouldn't include the deleted sectors anymore
|
||||
CreateBlockmap();
|
||||
}
|
||||
|
||||
if(selectedthings.Count > 0 || selectedsectors.Count > 0)
|
||||
|
|
Loading…
Reference in a new issue