Force excluded locations update when preset is applied. (#5205)

* Force excluded locations update when preset is applied.

* Apply same fix for tricks tab

* Address review comment
This commit is contained in:
Christopher Leggett 2025-03-24 17:58:56 -04:00 committed by GitHub
parent c7ff6e4700
commit 084627b8af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1937,6 +1937,8 @@ void RandomizerSettingsWindow::DrawElement() {
generated = 0;
randoThread.join();
}
static bool locationsTabOpen = false;
static bool tricksTabOpen = false;
bool disableEditingRandoSettings = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings);
const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_RANDOMIZER);
@ -1971,6 +1973,9 @@ void RandomizerSettingsWindow::DrawElement() {
CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected);
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
mSettings->UpdateOptionProperties();
// force excluded location list and trick list update if tab is open.
locationsTabOpen = false;
tricksTabOpen = false;
}
UIWidgets::Spacer(0);
@ -2060,7 +2065,6 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::EndDisabled();
ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA);
static bool locationsTabOpen = false;
if (ImGui::BeginTabItem("Locations")) {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
if (!locationsTabOpen) {
@ -2189,7 +2193,6 @@ void RandomizerSettingsWindow::DrawElement() {
}
ImGui::EndDisabled();
static bool tricksTabOpen = false;
if (ImGui::BeginTabItem("Tricks/Glitches")) {
if (!tricksTabOpen) {
tricksTabOpen = true;