Change GeoTrack props to byte too

if u say so, archit
This commit is contained in:
Kurt 2021-08-02 20:03:11 -07:00
parent d0a558a211
commit c1e6693b9c
4 changed files with 42 additions and 46 deletions

View file

@ -295,16 +295,16 @@ namespace PKHeX.Core
public override string HT_Name { get => GetString(0x78, 24); set => SetString(value, 12).CopyTo(Data, 0x78); }
public override int HT_Gender { get => Data[0x92]; set => Data[0x92] = (byte)value; }
public override int CurrentHandler { get => Data[0x93]; set => Data[0x93] = (byte)value; }
public int Geo1_Region { get => Data[0x94]; set => Data[0x94] = (byte)value; }
public int Geo1_Country { get => Data[0x95]; set => Data[0x95] = (byte)value; }
public int Geo2_Region { get => Data[0x96]; set => Data[0x96] = (byte)value; }
public int Geo2_Country { get => Data[0x97]; set => Data[0x97] = (byte)value; }
public int Geo3_Region { get => Data[0x98]; set => Data[0x98] = (byte)value; }
public int Geo3_Country { get => Data[0x99]; set => Data[0x99] = (byte)value; }
public int Geo4_Region { get => Data[0x9A]; set => Data[0x9A] = (byte)value; }
public int Geo4_Country { get => Data[0x9B]; set => Data[0x9B] = (byte)value; }
public int Geo5_Region { get => Data[0x9C]; set => Data[0x9C] = (byte)value; }
public int Geo5_Country { get => Data[0x9D]; set => Data[0x9D] = (byte)value; }
public byte Geo1_Region { get => Data[0x94]; set => Data[0x94] = value; }
public byte Geo1_Country { get => Data[0x95]; set => Data[0x95] = value; }
public byte Geo2_Region { get => Data[0x96]; set => Data[0x96] = value; }
public byte Geo2_Country { get => Data[0x97]; set => Data[0x97] = value; }
public byte Geo3_Region { get => Data[0x98]; set => Data[0x98] = value; }
public byte Geo3_Country { get => Data[0x99]; set => Data[0x99] = value; }
public byte Geo4_Region { get => Data[0x9A]; set => Data[0x9A] = value; }
public byte Geo4_Country { get => Data[0x9B]; set => Data[0x9B] = value; }
public byte Geo5_Region { get => Data[0x9C]; set => Data[0x9C] = value; }
public byte Geo5_Country { get => Data[0x9D]; set => Data[0x9D] = value; }
// 0x9E Unused
// 0x9F Unused
// 0xA0 Unused
@ -391,7 +391,7 @@ namespace PKHeX.Core
if (IsEgg) // No memories if is egg.
{
Geo1_Country = Geo2_Country = Geo3_Country = Geo4_Country = Geo5_Country =
Geo1_Region = Geo2_Region = Geo3_Region = Geo4_Region = Geo5_Region =
Geo1_Region = Geo2_Region = Geo3_Region = Geo4_Region = Geo5_Region = 0;
HT_Friendship = HT_Affection = HT_TextVar = HT_Memory = HT_Intensity = HT_Feeling =
/* OT_Friendship */ OT_Affection = OT_TextVar = OT_Memory = OT_Intensity = OT_Feeling = 0;

View file

@ -323,16 +323,16 @@ namespace PKHeX.Core
public override string HT_Name { get => GetString(0x78, 24); set => SetString(value, 12).CopyTo(Data, 0x78); }
public override int HT_Gender { get => Data[0x92]; set => Data[0x92] = (byte)value; }
public override int CurrentHandler { get => Data[0x93]; set => Data[0x93] = (byte)value; }
public int Geo1_Region { get => Data[0x94]; set => Data[0x94] = (byte)value; }
public int Geo1_Country { get => Data[0x95]; set => Data[0x95] = (byte)value; }
public int Geo2_Region { get => Data[0x96]; set => Data[0x96] = (byte)value; }
public int Geo2_Country { get => Data[0x97]; set => Data[0x97] = (byte)value; }
public int Geo3_Region { get => Data[0x98]; set => Data[0x98] = (byte)value; }
public int Geo3_Country { get => Data[0x99]; set => Data[0x99] = (byte)value; }
public int Geo4_Region { get => Data[0x9A]; set => Data[0x9A] = (byte)value; }
public int Geo4_Country { get => Data[0x9B]; set => Data[0x9B] = (byte)value; }
public int Geo5_Region { get => Data[0x9C]; set => Data[0x9C] = (byte)value; }
public int Geo5_Country { get => Data[0x9D]; set => Data[0x9D] = (byte)value; }
public byte Geo1_Region { get => Data[0x94]; set => Data[0x94] = value; }
public byte Geo1_Country { get => Data[0x95]; set => Data[0x95] = value; }
public byte Geo2_Region { get => Data[0x96]; set => Data[0x96] = value; }
public byte Geo2_Country { get => Data[0x97]; set => Data[0x97] = value; }
public byte Geo3_Region { get => Data[0x98]; set => Data[0x98] = value; }
public byte Geo3_Country { get => Data[0x99]; set => Data[0x99] = value; }
public byte Geo4_Region { get => Data[0x9A]; set => Data[0x9A] = value; }
public byte Geo4_Country { get => Data[0x9B]; set => Data[0x9B] = value; }
public byte Geo5_Region { get => Data[0x9C]; set => Data[0x9C] = value; }
public byte Geo5_Country { get => Data[0x9D]; set => Data[0x9D] = value; }
// 0x9E Unused
// 0x9F Unused
// 0xA0 Unused

View file

@ -5,16 +5,16 @@
/// </summary>
public interface IGeoTrack : IRegionOrigin
{
int Geo1_Region { get; set; }
int Geo2_Region { get; set; }
int Geo3_Region { get; set; }
int Geo4_Region { get; set; }
int Geo5_Region { get; set; }
int Geo1_Country { get; set; }
int Geo2_Country { get; set; }
int Geo3_Country { get; set; }
int Geo4_Country { get; set; }
int Geo5_Country { get; set; }
byte Geo1_Region { get; set; }
byte Geo2_Region { get; set; }
byte Geo3_Region { get; set; }
byte Geo4_Region { get; set; }
byte Geo5_Region { get; set; }
byte Geo1_Country { get; set; }
byte Geo2_Country { get; set; }
byte Geo3_Country { get; set; }
byte Geo4_Country { get; set; }
byte Geo5_Country { get; set; }
}
public static partial class Extensions
@ -25,12 +25,8 @@
g.Geo1_Region = g.Geo2_Region = g.Geo3_Region = g.Geo4_Region = g.Geo5_Region = 0;
}
public static void TradeGeoLocation(this IGeoTrack g, int GeoCountry, int GeoRegion)
public static void TradeGeoLocation(this IGeoTrack g, byte GeoCountry, byte GeoRegion)
{
// abort if the values are invalid
if (GeoCountry < 0 || GeoRegion < 0)
return;
// Trickle existing values up one slot
g.Geo5_Country = g.Geo4_Country;
g.Geo5_Region = g.Geo4_Region;

View file

@ -157,16 +157,16 @@ namespace PKHeX.WinForms
// Save Region & Country Data
if (pkm is IGeoTrack g)
{
g.Geo1_Region = WinFormsUtil.GetIndex(CB_Region0);
g.Geo2_Region = WinFormsUtil.GetIndex(CB_Region1);
g.Geo3_Region = WinFormsUtil.GetIndex(CB_Region2);
g.Geo4_Region = WinFormsUtil.GetIndex(CB_Region3);
g.Geo5_Region = WinFormsUtil.GetIndex(CB_Region4);
g.Geo1_Country = WinFormsUtil.GetIndex(CB_Country0);
g.Geo2_Country = WinFormsUtil.GetIndex(CB_Country1);
g.Geo3_Country = WinFormsUtil.GetIndex(CB_Country2);
g.Geo4_Country = WinFormsUtil.GetIndex(CB_Country3);
g.Geo5_Country = WinFormsUtil.GetIndex(CB_Country4);
g.Geo1_Region = (byte)WinFormsUtil.GetIndex(CB_Region0);
g.Geo2_Region = (byte)WinFormsUtil.GetIndex(CB_Region1);
g.Geo3_Region = (byte)WinFormsUtil.GetIndex(CB_Region2);
g.Geo4_Region = (byte)WinFormsUtil.GetIndex(CB_Region3);
g.Geo5_Region = (byte)WinFormsUtil.GetIndex(CB_Region4);
g.Geo1_Country = (byte)WinFormsUtil.GetIndex(CB_Country0);
g.Geo2_Country = (byte)WinFormsUtil.GetIndex(CB_Country1);
g.Geo3_Country = (byte)WinFormsUtil.GetIndex(CB_Country2);
g.Geo4_Country = (byte)WinFormsUtil.GetIndex(CB_Country3);
g.Geo5_Country = (byte)WinFormsUtil.GetIndex(CB_Country4);
}
// Save 0-255 stats