mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
- Added check for unused sectors and automatic removal when opening a map
This commit is contained in:
parent
622ff71056
commit
79116a2a42
2 changed files with 32 additions and 0 deletions
|
@ -361,6 +361,9 @@ namespace CodeImp.DoomBuilder
|
|||
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, options.StrictPatches, false);
|
||||
data.Load(configinfo.Resources, options.Resources, maplocation);
|
||||
|
||||
// Remove unused sectors
|
||||
map.RemoveUnusedSectors(true);
|
||||
|
||||
// Update structures
|
||||
options.ApplyGridSettings();
|
||||
map.UpdateConfiguration();
|
||||
|
|
|
@ -1885,6 +1885,35 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
return count;
|
||||
}
|
||||
|
||||
// This removes unused sectors and returns the number of removed sectors
|
||||
public int RemoveUnusedSectors(bool reportwarnings)
|
||||
{
|
||||
int count = 0;
|
||||
LinkedListNode<Sector> n = sectors.First;
|
||||
|
||||
// Go for all sectors
|
||||
int index = 0;
|
||||
while(n != null)
|
||||
{
|
||||
LinkedListNode<Sector> nn = n.Next;
|
||||
|
||||
// Remove when unused
|
||||
if(n.Value.Sidedefs.Count == 0)
|
||||
{
|
||||
if(reportwarnings)
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "Sector " + index + " was unused and has been removed.");
|
||||
|
||||
n.Value.Dispose();
|
||||
count++;
|
||||
}
|
||||
|
||||
index++;
|
||||
n = nn;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// This joins overlapping lines together
|
||||
// Returns the number of joins made
|
||||
|
|
Loading…
Reference in a new issue