Restart RecipeNote solving if it was stopped halfway through

This commit is contained in:
Asriel Camora
2023-11-15 00:12:35 -08:00
parent 36df0afb4c
commit ca92a78197
+6 -1
View File
@@ -102,6 +102,11 @@ public sealed unsafe class RecipeNote : Window, IDisposable
{ {
if (wasOpen) if (wasOpen)
BestMacroTokenSource?.Cancel(); BestMacroTokenSource?.Cancel();
else
{
if (!BestSuggestedMacro.HasValue && CraftStatus == CraftableStatus.OK && BestMacroTokenSource == null)
CalculateBestMacros();
}
} }
wasOpen = isOpen; wasOpen = isOpen;
@@ -172,7 +177,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
statsChanged = true; statsChanged = true;
} }
if ((statsChanged || (BestMacroTokenSource?.IsCancellationRequested ?? false)) && CraftStatus == CraftableStatus.OK) if (statsChanged && CraftStatus == CraftableStatus.OK)
CalculateBestMacros(); CalculateBestMacros();
return true; return true;