don't use Guid.GetHashCode, this was a leftover from some old bad code

This commit is contained in:
adelikat 2019-11-24 15:53:33 -06:00
parent caced9c2a8
commit 60487c6a96
2 changed files with 7 additions and 7 deletions

View File

@ -427,19 +427,19 @@ namespace BizHawk.Client.Common
return Branches.SingleOrDefault(b => b.UniqueIdentifier == id);
}
public int BranchHashByIndex(int index)
public Guid BranchGuidByIndex(int index)
{
if (index >= Branches.Count)
{
return -1;
return Guid.Empty;
}
return Branches[index].UniqueIdentifier.GetHashCode();
return Branches[index].UniqueIdentifier;
}
public int BranchIndexByHash(int hash)
public int BranchIndexByHash(Guid uuid)
{
TasBranch branch = Branches.SingleOrDefault(b => b.UniqueIdentifier.GetHashCode() == hash);
TasBranch branch = Branches.SingleOrDefault(b => b.UniqueIdentifier == uuid);
if (branch == null)
{
return -1;

View File

@ -655,9 +655,9 @@ namespace BizHawk.Client.EmuHawk
{
if (e.NewCell != null && e.NewCell.IsDataCell && e.OldCell.RowIndex.Value < Movie.BranchCount)
{
int currentHash = Movie.BranchHashByIndex(Movie.CurrentBranch);
var guid = Movie.BranchGuidByIndex(Movie.CurrentBranch);
Movie.SwapBranches(e.OldCell.RowIndex.Value, e.NewCell.RowIndex.Value);
int newIndex = Movie.BranchIndexByHash(currentHash);
int newIndex = Movie.BranchIndexByHash(guid);
Movie.CurrentBranch = newIndex;
Select(newIndex, true);
}