Fix gen4 (and 3 by usage) ’ ' apostrophe -> data

’ is aliased to ' for cleaner display to user; there's no usages of this
method beside gen3/4 strings.

fix early truncation of gen3 strings (don't put terminator on prior
valid char)

https://projectpokemon.org/home/forums/topic/44777-some-little-bug-in-emerald-leafgreen-and-blue-vc/
Thanks cicciochiave!
This commit is contained in:
Kurt 2018-04-11 16:51:33 -07:00
parent b1cb5226f7
commit 7c1f163140

View file

@ -278,7 +278,7 @@ namespace PKHeX.Core
ushort chr = value[i];
byte val = SetG3Char(chr, jp);
if (val == 0xFF || chr == 0xFF)
{ Array.Resize(ref strdata, i); break; }
{ Array.Resize(ref strdata, i + 1); break; }
strdata[i] = val;
}
if (strdata.Length > 0)
@ -548,6 +548,8 @@ namespace PKHeX.Core
/// <returns>Encoded value.</returns>
private static ushort ConvertChar2ValueG4(ushort chr)
{
if (chr == 0x27) // apostrophe, used by Farfetch'd
return 0x1B3; // here rather than in static constructor to prevent byte[]->str outputting instead of '
return G4CharId.TryGetValue(chr, out int index)
? G4Values[index] : ushort.MaxValue;
}