Clean up debug serialisation of `Cell`

fixes 2a67cf93e
This commit is contained in:
James Groom 2024-03-20 19:31:34 +00:00 committed by GitHub
parent 57439f9697
commit a3aa67681f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -41,6 +41,9 @@ namespace BizHawk.Client.EmuHawk
return Column.GetHashCode() + RowIndex.GetHashCode();
}
public override string ToString()
=> $"Cell(r: {RowIndex?.ToString() ?? "null"}, c: \"{Column?.Name ?? "(no column)"}\")";
public static bool operator ==(Cell a, Cell b)
{
return a?.Equals(b) ?? b is null;
@ -101,7 +104,7 @@ namespace BizHawk.Client.EmuHawk
var i = _list.BinarySearch(item);
if (i >= 0)
{
Debug.Assert(false, $"{nameof(CellList)}'s distinctness invariant was almost broken! CellList.Add({(item is null ? "null" : $"Cell(r: {item.RowIndex}, c: \"{item.Column?.Name ?? "(unnamed)"}\")")})");
Debug.Assert(false, $"{nameof(CellList)}'s distinctness invariant was almost broken! CellList.Add({(item is null ? "null" : item.ToString())})");
return;
}
_list.Insert(~i, item);