From c9733c23f3413683f07948288818c60d73e4b88b Mon Sep 17 00:00:00 2001 From: cadon Date: Sat, 13 Mar 2021 18:03:53 +0100 Subject: [PATCH] ignore ocr looped species in recent --- ARKBreedingStats/Form1.cs | 8 ++++---- ARKBreedingStats/SpeciesSelector.cs | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index fa41e4a5..c4cf627a 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -2079,7 +2079,7 @@ public void DoOcr(string imageFilePath = "", bool manuallyTriggered = true) if (manuallyTriggered && sameValues) { int newIndex = (possibleSpecies.IndexOf(_lastOcrSpecies) + 1) % possibleSpecies.Count; - speciesSelector1.SetSpecies(possibleSpecies[newIndex]); + speciesSelector1.SetSpecies(possibleSpecies[newIndex], ignoreInRecent: true); _lastOcrSpecies = possibleSpecies[newIndex]; _lastOcrValues = OcrValues; ExtractLevels(true); @@ -2088,11 +2088,11 @@ public void DoOcr(string imageFilePath = "", bool manuallyTriggered = true) { // automated, or first manual attempt at new values bool foundPossiblyGood = false; - for (int speciesOption = 0; speciesOption < possibleSpecies.Count && !foundPossiblyGood; speciesOption++) + for (int speciesOption = 0; !foundPossiblyGood && speciesOption < possibleSpecies.Count; speciesOption++) { // if the last OCR'ed values are the same as this one, the user may not be happy with the dino species selection and want another one - // so we'll cycle to the next one, but only if the OCR is manually triggered, on autotrigger (ie, overlay), don't change - speciesSelector1.SetSpecies(possibleSpecies[speciesOption]); + // so we'll cycle to the next one, but only if the OCR is manually triggered, on auto trigger (i.e. overlay), don't change + speciesSelector1.SetSpecies(possibleSpecies[speciesOption], ignoreInRecent: true); _lastOcrSpecies = possibleSpecies[speciesOption]; _lastOcrValues = OcrValues; foundPossiblyGood = ExtractLevels(showLevelsInOverlay: !manuallyTriggered); diff --git a/ARKBreedingStats/SpeciesSelector.cs b/ARKBreedingStats/SpeciesSelector.cs index efd1d216..a0f6e4dd 100644 --- a/ARKBreedingStats/SpeciesSelector.cs +++ b/ARKBreedingStats/SpeciesSelector.cs @@ -255,7 +255,7 @@ public void SetSpeciesByName(string speciesName) } } - public void SetSpecies(Species species, bool alsoTriggerOnSameSpecies = false) + public void SetSpecies(Species species, bool alsoTriggerOnSameSpecies = false, bool ignoreInRecent = false) { if (species == null) return; if (SelectedSpecies == species) @@ -265,11 +265,17 @@ public void SetSpecies(Species species, bool alsoTriggerOnSameSpecies = false) return; } - _lastSpeciesBPs.Remove(species.blueprintPath); - _lastSpeciesBPs.Insert(0, species.blueprintPath); - if (_lastSpeciesBPs.Count > Properties.Settings.Default.SpeciesSelectorCountLastSpecies) // only keep keepNrLastSpecies of the last species in this list - _lastSpeciesBPs.RemoveRange(Properties.Settings.Default.SpeciesSelectorCountLastSpecies, _lastSpeciesBPs.Count - Properties.Settings.Default.SpeciesSelectorCountLastSpecies); - UpdateLastSpecies(); + if (!ignoreInRecent) + { + _lastSpeciesBPs.Remove(species.blueprintPath); + _lastSpeciesBPs.Insert(0, species.blueprintPath); + if (_lastSpeciesBPs.Count > Properties.Settings.Default.SpeciesSelectorCountLastSpecies + ) // only keep keepNrLastSpecies of the last species in this list + _lastSpeciesBPs.RemoveRange(Properties.Settings.Default.SpeciesSelectorCountLastSpecies, + _lastSpeciesBPs.Count - Properties.Settings.Default.SpeciesSelectorCountLastSpecies); + UpdateLastSpecies(); + } + SelectedSpecies = species; OnSpeciesSelected?.Invoke(true);