mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-25 20:59:55 -05:00
Fix direct cast from object(->int)->ushort
https://projectpokemon.org/home/forums/topic/62327-error-occurs-when-trying-to-goto-a-specific-pokemon-through-combo-box-in-pokedex-editor/ ty liopds !
This commit is contained in:
@@ -727,7 +727,7 @@ private void CHK_Continue_CheckedChanged(object sender, EventArgs e)
|
||||
|
||||
private void ChangeSpecies(object sender, EventArgs e)
|
||||
{
|
||||
species = (ushort)CB_Species.SelectedValue;
|
||||
species = (ushort)WinFormsUtil.GetIndex(CB_Species);
|
||||
if (editing)
|
||||
return;
|
||||
editing = true;
|
||||
|
||||
@@ -57,7 +57,7 @@ private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
SetEntry();
|
||||
|
||||
editing = true;
|
||||
species = (ushort)CB_Species.SelectedValue;
|
||||
species = (ushort)WinFormsUtil.GetIndex(CB_Species);
|
||||
LB_Species.SelectedIndex = species - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
GetEntry();
|
||||
|
||||
@@ -207,7 +207,7 @@ private void SaveMain()
|
||||
for (int i = 0; i < cbr.Length; i++)
|
||||
{
|
||||
int c = SAV.Data[ofsRoamer + 0x2E + i];
|
||||
var d = (int)cbr[i].SelectedValue;
|
||||
var d = (ushort)WinFormsUtil.GetIndex(cbr[i]);
|
||||
|
||||
if (c == d)
|
||||
continue;
|
||||
|
||||
@@ -47,7 +47,7 @@ private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
SetEntry();
|
||||
|
||||
editing = true;
|
||||
species = (ushort)CB_Species.SelectedValue;
|
||||
species = (ushort)WinFormsUtil.GetIndex(CB_Species);
|
||||
LB_Species.SelectedIndex = species - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
GetEntry();
|
||||
|
||||
@@ -50,7 +50,7 @@ private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
SetEntry();
|
||||
|
||||
editing = true;
|
||||
species = (ushort)CB_Species.SelectedValue;
|
||||
species = (ushort)WinFormsUtil.GetIndex(CB_Species);
|
||||
LB_Species.SelectedIndex = species - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
GetEntry();
|
||||
|
||||
@@ -50,7 +50,7 @@ private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
SetEntry();
|
||||
|
||||
editing = true;
|
||||
species = (ushort)CB_Species.SelectedValue;
|
||||
species = (ushort)WinFormsUtil.GetIndex(CB_Species);
|
||||
LB_Species.SelectedIndex = species - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
GetEntry();
|
||||
|
||||
@@ -66,7 +66,7 @@ private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
SetEntry();
|
||||
|
||||
editing = true;
|
||||
currentSpecies = (ushort)CB_Species.SelectedValue;
|
||||
currentSpecies = (ushort)WinFormsUtil.GetIndex(CB_Species);
|
||||
LB_Species.SelectedIndex = currentSpecies - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
if (!allModifying) FillLBForms();
|
||||
|
||||
@@ -53,7 +53,7 @@ private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
SetEntry();
|
||||
|
||||
editing = true;
|
||||
currentSpecies = (ushort)CB_Species.SelectedValue;
|
||||
currentSpecies = (ushort)WinFormsUtil.GetIndex(CB_Species);
|
||||
LB_Species.SelectedIndex = currentSpecies - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
if (!allModifying) FillLBForms();
|
||||
|
||||
@@ -46,7 +46,7 @@ private void ChangeCBSpecies(object sender, EventArgs e)
|
||||
SetEntry();
|
||||
|
||||
editing = true;
|
||||
species = (ushort)CB_Species.SelectedValue;
|
||||
species = (ushort)WinFormsUtil.GetIndex(CB_Species);
|
||||
LB_Species.SelectedIndex = species - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
GetEntry();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
@@ -142,7 +142,7 @@ private void LoadWork(IEnumerable<EventVarGroup> editorWork)
|
||||
{
|
||||
if (editing)
|
||||
return;
|
||||
var value = (int) cb.SelectedValue;
|
||||
var value = WinFormsUtil.GetIndex(cb);
|
||||
editing = true;
|
||||
var match = f.Options.FirstOrDefault(z => z.Value == value);
|
||||
nud.Enabled = match?.Custom == true;
|
||||
|
||||
Reference in New Issue
Block a user