More version-location shenanigans

Should be behaving correctly for gen!2=>gen2 now
This commit is contained in:
Kurt 2021-01-02 10:35:48 -08:00
parent f785231692
commit d02dd29e83

View File

@ -1185,15 +1185,10 @@ private void UpdateSpecies(object sender, EventArgs e)
private void UpdateOriginGame(object sender, EventArgs e)
{
GameVersion version = (GameVersion)WinFormsUtil.GetIndex(CB_GameOrigin);
CheckMetLocationChange(version);
if (FieldsLoaded)
Entity.Version = (int)version;
// Does the list of locations need to be changed to another group?
var group = GameUtil.GetMetLocationVersionGroup(version);
if (group != origintrack)
ReloadMetLocations(version);
origintrack = group;
// Visibility logic for Gen 4 encounter type; only show for Gen 4 Pokemon.
if (Entity.Format >= 4)
{
@ -1210,6 +1205,15 @@ private void UpdateOriginGame(object sender, EventArgs e)
UpdateLegality();
}
private void CheckMetLocationChange(GameVersion version)
{
// Does the list of locations need to be changed to another group?
var group = GameUtil.GetMetLocationVersionGroup(version);
if (group != origintrack)
ReloadMetLocations(version);
origintrack = group;
}
private void ReloadMetLocations(GameVersion version)
{
var metList = GameInfo.GetLocationList(version, Entity.Format, egg: false);
@ -1955,7 +1959,10 @@ private void PopulateFilteredDataSources(ITrainerInfo sav, bool force = false)
var source = GameInfo.FilteredSources;
if (sav.Generation >= 2)
{
CheckMetLocationChange((GameVersion) sav.Game);
SetIfDifferentCount(source.Items, CB_HeldItem, force);
}
if (sav.Generation >= 3)
{