Skip to content

Commit

Permalink
Build order restart error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nordie92 committed Nov 15, 2021
1 parent 905c461 commit 70384b1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions AoE4BO/Overlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public Overlay()

public void StartBuildOrder(BuildOrder buildOrder)
{
if (_thread != null && _thread.ThreadState == System.Threading.ThreadState.Background)
StopBuildOrder();

_buildOrder = buildOrder;

// start stopwatch to get draw delta time
Expand All @@ -45,6 +48,8 @@ public void StartBuildOrder(BuildOrder buildOrder)
public void StopBuildOrder()
{
_stopDrawThread = true;
while (_stopDrawThread)
Thread.Sleep(100);
Global.OverlayState = OverlayState.Idle;
}

Expand All @@ -53,8 +58,6 @@ public void RestartBuildOrder()
if (_buildOrder != null)
{
StopBuildOrder();
while (_stopDrawThread)
Thread.Sleep(100);
StartBuildOrder(_buildOrder);
}
}
Expand Down Expand Up @@ -110,10 +113,10 @@ private void DoWork(object state)
}
finally
{
_stopDrawThread = false;
Thread.Sleep(2000);
Thread.Sleep(100);
}
}
_stopDrawThread = false;
}

private void OnTick(object sender, EventArgs e)
Expand Down

0 comments on commit 70384b1

Please sign in to comment.