Skip to content

Commit

Permalink
ignore ocr looped species in recent
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Mar 13, 2021
1 parent 5ecd19b commit c9733c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
8 changes: 4 additions & 4 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
18 changes: 12 additions & 6 deletions ARKBreedingStats/SpeciesSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down

0 comments on commit c9733c2

Please sign in to comment.