From fd2a3222fb90a5ca14c4a22e91e065679139c39d Mon Sep 17 00:00:00 2001 From: Nifyr Date: Sat, 9 Apr 2022 16:03:06 +0200 Subject: [PATCH] Fixed bugged trainer types --- Forms/TrainerEditorForm.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Forms/TrainerEditorForm.cs b/Forms/TrainerEditorForm.cs index 2aef51d..a76e500 100644 --- a/Forms/TrainerEditorForm.cs +++ b/Forms/TrainerEditorForm.cs @@ -16,6 +16,7 @@ public partial class TrainerEditorForm : Form { public List trainers; public Dictionary trainerTypeLabels; + public Dictionary trainerTypeToCC; public List items; public Trainer t; private TrainerPokemonEditorForm tpef; @@ -23,9 +24,15 @@ public partial class TrainerEditorForm : Form public TrainerEditorForm() { trainerTypeLabels = new(); + trainerTypeToCC = new(); trainerTypeLabels.Add(-1, "None"); - foreach (TrainerType tt in gameData.trainerTypes) + trainerTypeToCC.Add(-1, 0); + for (int i = 0; i < gameData.trainerTypes.Count; i++) + { + TrainerType tt = gameData.trainerTypes[i]; trainerTypeLabels.Add(tt.GetID(), tt.GetName()); + trainerTypeToCC.Add(tt.GetID(), i + 1); + } items = gameData.items.Select(o => o.GetName()).ToList(); InitializeComponent(); @@ -65,7 +72,7 @@ private void RefreshTrainerDisplay() { RefreshTextBoxDisplay(); - trainerTypeComboBox.SelectedItem = trainerTypeLabels[t.trainerTypeID]; + trainerTypeComboBox.SelectedIndex = trainerTypeToCC[t.trainerTypeID]; arenaIDNumericUpDown.Value = t.arenaID; effectIDNumericUpDown.Value = t.effectID;