attempt in fixing mysterious timer crash again
This commit is contained in:
@@ -59,24 +59,21 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
while (timedActions.Count > 0)
|
List<TimedAction> timedActionsToRemove = new List<TimedAction>();
|
||||||
|
for (int i = 0; i < timedActions.Count; i++)
|
||||||
{
|
{
|
||||||
if (timedActions == null)
|
|
||||||
{
|
|
||||||
throw new Exception($"timedActions was null, how is this possible? On MainThread: {GameMain.MainThread == System.Threading.Thread.CurrentThread}");
|
|
||||||
}
|
|
||||||
|
|
||||||
TimedAction timedAction = timedActions[0];
|
TimedAction timedAction = timedActions[0];
|
||||||
if (Time >= timedAction.executionTime)
|
if (Time >= timedAction.executionTime)
|
||||||
{
|
{
|
||||||
timedAction.action();
|
timedAction.action();
|
||||||
timedActions.RemoveAt(0);
|
timedActionsToRemove.Add(timedAction);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (TimedAction timedAction in timedActionsToRemove)
|
||||||
|
{
|
||||||
|
timedActions.Remove(timedAction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
|
|||||||
Reference in New Issue
Block a user