mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-27 12:02:13 -05:00
improve pcd<->pgt matching
Hotfix wasn't appropriate: check bytes 0 & 1 in addition to 3+, add bounds checking
This commit is contained in:
parent
f0a570d132
commit
2ab175db6e
|
|
@ -69,8 +69,19 @@ public override string CardTitle
|
|||
|
||||
public bool GiftEquals(PGT pgt)
|
||||
{
|
||||
// Skip over the PGT's "Corresponding PCD Slot"
|
||||
return Gift.Data.Skip(3).SequenceEqual(pgt.Data.Skip(3));
|
||||
// Skip over the PGT's "Corresponding PCD Slot" @ 0x02
|
||||
byte[] g = pgt.Data;
|
||||
byte[] c = Gift.Data;
|
||||
if (g.Length != c.Length || g.Length < 3)
|
||||
return false;
|
||||
for (int i = 0; i < 2; i++)
|
||||
if (g[i] != c[i])
|
||||
return false;
|
||||
for (int i = 3; i < g.Length; i++)
|
||||
if (g[i] != c[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override PKM convertToPKM(SaveFile SAV)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user