Rename IStateManager.StateCount -> IStateManager.Count

This commit is contained in:
adelikat 2019-06-15 14:49:43 -05:00
parent cb4e71ebf7
commit e0a51eaab1
4 changed files with 11 additions and 10 deletions

View File

@ -34,6 +34,8 @@ namespace BizHawk.Client.Common
bool Any();
int Count { get; }
// TODO: rename to Last
int LastStatedFrame { get; }
@ -52,8 +54,6 @@ namespace BizHawk.Client.Common
bool RemoveState(int frame);
int StateCount { get; }
int GetStateIndexByFrame(int frame);
int GetStateFrameByIndex(int index);

View File

@ -65,7 +65,7 @@ namespace BizHawk.Client.Common
// todo: go through all states once, remove as many as we need. refactor to not need goto
public void Trigger(int decayStates)
{
for (; decayStates > 0 && _tsm.StateCount > 1;)
for (; decayStates > 0 && _tsm.Count > 1;)
{
int baseStateIndex = _tsm.GetStateIndexByFrame(Global.Emulator.Frame);
int baseStateFrame = _tsm.GetStateFrameByIndex(baseStateIndex) / _step; // reduce right away
@ -119,7 +119,7 @@ namespace BizHawk.Client.Common
}
}
for (int currentStateIndex = _tsm.StateCount - 1; currentStateIndex > baseStateIndex; currentStateIndex--)
for (int currentStateIndex = _tsm.Count - 1; currentStateIndex > baseStateIndex; currentStateIndex--)
{
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);

View File

@ -22,6 +22,7 @@ namespace BizHawk.Client.Common
public Action<int> InvalidateCallback { get; set; }
private void CallInvalidateCallback(int index)
{
InvalidateCallback?.Invoke(index);
@ -135,7 +136,7 @@ namespace BizHawk.Client.Common
}
}
public byte[] InitialState
private byte[] InitialState
{
get
{
@ -281,9 +282,9 @@ namespace BizHawk.Client.Common
/// </summary>
public void LimitStateCount()
{
if (StateCount + 1 > _maxStates || DiskUsed > (ulong)Settings.DiskCapacitymb * 1024 * 1024)
if (Count + 1 > _maxStates || DiskUsed > (ulong)Settings.DiskCapacitymb * 1024 * 1024)
{
_decay.Trigger(StateCount + 1 - _maxStates);
_decay.Trigger(Count + 1 - _maxStates);
}
}
@ -498,7 +499,7 @@ namespace BizHawk.Client.Common
}
}
public int StateCount => _states.Count;
public int Count => _states.Count;
public bool Any()
{
@ -527,7 +528,7 @@ namespace BizHawk.Client.Common
{
get
{
if (StateCount > 0)
if (Count > 0)
{
return LastKey;
}

View File

@ -995,7 +995,7 @@ namespace BizHawk.Client.EmuHawk
private void SetSplicer()
{
// TODO: columns selected?
var temp = $"Selected: {TasView.SelectedRows.Count()} {(TasView.SelectedRows.Count() == 1 ? "frame" : "frames")}, States: {CurrentTasMovie.TasStateManager.StateCount}";
var temp = $"Selected: {TasView.SelectedRows.Count()} {(TasView.SelectedRows.Count() == 1 ? "frame" : "frames")}, States: {CurrentTasMovie.TasStateManager.Count}";
if (_tasClipboard.Any()) temp += $", Clipboard: {_tasClipboard.Count} {(_tasClipboard.Count == 1 ? "frame" : "frames")}";
SplicerStatusLabel.Text = temp;
}