Fix pk2->pk1 nickname copy

nobody noticed until I did
This commit is contained in:
Kurt 2022-03-10 18:00:45 -08:00
parent b45ce123da
commit 2e6364dceb
2 changed files with 2 additions and 3 deletions

View File

@ -122,7 +122,7 @@ public PK1 ConvertToPK1()
}
// Status = 0
OT_Trash.CopyTo(pk1.OT_Trash);
Nickname_Trash.CopyTo(pk1.OT_Trash);
Nickname_Trash.CopyTo(pk1.Nickname_Trash);
pk1.ClearInvalidMoves();

View File

@ -108,8 +108,7 @@ private void SetStringKeepTerminatorStyle(ReadOnlySpan<char> value, Span<byte> e
// Reset the destination buffer based on the termination style of the existing string.
bool zeroed = exist.IndexOf((byte)0) != -1;
byte fill = zeroed ? (byte)0 : StringConverter12.G1TerminatorCode;
for (int i = 0; i < exist.Length; i++)
exist[i] = fill;
exist.Fill(fill);
int finalLength = Math.Min(value.Length + 1, exist.Length);
SetString(value, exist, finalLength);