mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
fixed bugs in error checking blockmap and progress bar
This commit is contained in:
parent
743b6db2e6
commit
1e9993442d
5 changed files with 41 additions and 11 deletions
|
@ -44,6 +44,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
private int PROGRESS_STEP = 1000;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Destructor
|
||||
|
@ -52,7 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public CheckLineReferences()
|
||||
{
|
||||
// Total progress is done when all lines are checked
|
||||
SetTotalProgress(General.Map.Map.Linedefs.Count);
|
||||
SetTotalProgress(General.Map.Map.Linedefs.Count / PROGRESS_STEP);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -62,6 +64,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This runs the check
|
||||
public override void Run()
|
||||
{
|
||||
int progress = 0;
|
||||
int stepprogress = 0;
|
||||
|
||||
// Go for all the liendefs
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
|
@ -89,9 +94,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Handle thread interruption
|
||||
try { Thread.Sleep(0); }
|
||||
catch(ThreadInterruptedException) { return; }
|
||||
|
||||
|
||||
// We are making progress!
|
||||
AddProgress(1);
|
||||
if((++progress / PROGRESS_STEP) > stepprogress)
|
||||
{
|
||||
stepprogress = (progress / PROGRESS_STEP);
|
||||
AddProgress(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const int PROGRESS_STEP = 100;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Destructor
|
||||
|
@ -52,7 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public CheckOverlappingLines()
|
||||
{
|
||||
// Total progress is done when all lines are checked
|
||||
SetTotalProgress(General.Map.Map.Linedefs.Count);
|
||||
SetTotalProgress(General.Map.Map.Linedefs.Count / PROGRESS_STEP);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -64,7 +66,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
Dictionary<Linedef, Linedef> donelines = new Dictionary<Linedef, Linedef>();
|
||||
BlockMap blockmap = BuilderPlug.Me.ErrorCheckForm.BlockMap;
|
||||
|
||||
int progress = 0;
|
||||
int stepprogress = 0;
|
||||
|
||||
// Go for all the liendefs
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
{
|
||||
|
@ -118,9 +122,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Handle thread interruption
|
||||
try { Thread.Sleep(0); }
|
||||
catch(ThreadInterruptedException) { return; }
|
||||
|
||||
|
||||
// We are making progress!
|
||||
AddProgress(1);
|
||||
if((++progress / PROGRESS_STEP) > stepprogress)
|
||||
{
|
||||
stepprogress = (progress / PROGRESS_STEP);
|
||||
AddProgress(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const int PROGRESS_STEP = 10;
|
||||
private const float ALLOWED_STUCK_DISTANCE = 6.0f;
|
||||
|
||||
#endregion
|
||||
|
@ -55,7 +56,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public CheckStuckedThings()
|
||||
{
|
||||
// Total progress is done when all things are checked
|
||||
SetTotalProgress(General.Map.Map.Things.Count);
|
||||
SetTotalProgress(General.Map.Map.Things.Count / PROGRESS_STEP);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -66,6 +67,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public override void Run()
|
||||
{
|
||||
BlockMap blockmap = BuilderPlug.Me.ErrorCheckForm.BlockMap;
|
||||
int progress = 0;
|
||||
int stepprogress = 0;
|
||||
|
||||
// Go for all the things
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
|
@ -151,9 +154,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Handle thread interruption
|
||||
try { Thread.Sleep(0); }
|
||||
catch(ThreadInterruptedException) { return; }
|
||||
|
||||
|
||||
// We are making progress!
|
||||
AddProgress(1);
|
||||
if((++progress / PROGRESS_STEP) > stepprogress)
|
||||
{
|
||||
stepprogress = (progress / PROGRESS_STEP);
|
||||
AddProgress(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
protected BlockEntry[,] blockmap;
|
||||
protected Size size;
|
||||
protected RectangleF range;
|
||||
protected Vector2D rangelefttop;
|
||||
|
||||
// State
|
||||
private bool isdisposed;
|
||||
|
@ -76,6 +77,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
// Initialize
|
||||
this.range = range;
|
||||
rangelefttop = new Vector2D(range.Left, range.Top);
|
||||
Point lefttop = new Point((int)range.Left >> BLOCK_SIZE_SHIFT, (int)range.Top >> BLOCK_SIZE_SHIFT);
|
||||
Point rightbottom = new Point((int)range.Right >> BLOCK_SIZE_SHIFT, (int)range.Bottom >> BLOCK_SIZE_SHIFT);
|
||||
size = new Size((rightbottom.X - lefttop.X) + 1, (rightbottom.Y - lefttop.Y) + 1);
|
||||
|
@ -199,7 +201,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
// Find start and end block
|
||||
pos = GetBlockCoordinates(v1);
|
||||
end = GetBlockCoordinates(v2);
|
||||
|
||||
v1 -= rangelefttop;
|
||||
v2 -= rangelefttop;
|
||||
|
||||
// Horizontal straight line?
|
||||
if(pos.Y == end.Y)
|
||||
{
|
||||
|
@ -365,6 +369,8 @@ namespace CodeImp.DoomBuilder.Map
|
|||
// Find start and end block
|
||||
pos = GetBlockCoordinates(v1);
|
||||
end = GetBlockCoordinates(v2);
|
||||
v1 -= rangelefttop;
|
||||
v2 -= rangelefttop;
|
||||
|
||||
// Horizontal straight line?
|
||||
if(pos.Y == end.Y)
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue