I think this is the correct wasLag logic

This commit is contained in:
adelikat 2019-06-15 13:10:31 -05:00
parent f431492944
commit 694ba93ec1
1 changed files with 14 additions and 8 deletions

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
{
if (!value.HasValue)
{
_lagLog.Remove(frame);
RemoveLagEntry(frame);
return;
}
@ -54,13 +54,7 @@ namespace BizHawk.Client.Common
var frames = _lagLog.Keys.Where(k => k > frame).ToList();
foreach (var f in frames)
{
bool lag;
if (_lagLog.TryGetValue(f, out lag))
{
_wasLag[f] = lag;
}
_lagLog.Remove(f);
RemoveLagEntry(frame);
}
return frames.Any();
@ -116,5 +110,17 @@ namespace BizHawk.Client.Common
_wasLag.Remove(i);
}
}
private void RemoveLagEntry(int frame)
{
bool lag;
var result = _lagLog.TryGetValue(frame, out lag);
if (result)
{
_wasLag[frame] = lag;
}
_lagLog.Remove(frame);
}
}
}