Make tricks and locations lists re-evaluate after preset application. (#6263)
This commit is contained in:
@@ -122,6 +122,8 @@ void applyPreset(std::string presetName, std::vector<PresetSection> includeSecti
|
|||||||
}
|
}
|
||||||
if (i == PRESET_SECTION_RANDOMIZER) {
|
if (i == PRESET_SECTION_RANDOMIZER) {
|
||||||
Rando::Settings::GetInstance()->UpdateAllOptions();
|
Rando::Settings::GetInstance()->UpdateAllOptions();
|
||||||
|
SohGui::UpdateMenuTricks();
|
||||||
|
SohGui::UpdateMenuLocations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ static std::map<int32_t, const char*> languages = {
|
|||||||
{ LANGUAGE_FRA, "French" },
|
{ LANGUAGE_FRA, "French" },
|
||||||
{ LANGUAGE_JPN, "Japanese" },
|
{ LANGUAGE_JPN, "Japanese" },
|
||||||
};
|
};
|
||||||
|
void UpdateMenuTricks();
|
||||||
|
void UpdateMenuLocations();
|
||||||
|
|
||||||
class SohMenu : public Ship::Menu {
|
class SohMenu : public Ship::Menu {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -38,15 +38,8 @@ void DrawLocationsMenu(WidgetInfo& info) {
|
|||||||
ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings);
|
ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
|
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
|
||||||
if (locationsDirty || currMQDungeonSetting != prevMQDungeonSetting) {
|
if (locationsDirty || currMQDungeonSetting != prevMQDungeonSetting) {
|
||||||
RandomizerCheckObjects::UpdateImGuiVisibility();
|
|
||||||
// todo: this efficently when we build out cvar array support
|
|
||||||
std::stringstream excludedLocationStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), ""));
|
|
||||||
std::string excludedLocationString;
|
|
||||||
excludedLocations.clear();
|
|
||||||
while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
|
|
||||||
excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString));
|
|
||||||
}
|
|
||||||
locationsDirty = false;
|
locationsDirty = false;
|
||||||
|
UpdateMenuLocations();
|
||||||
}
|
}
|
||||||
prevMQDungeonSetting = currMQDungeonSetting;
|
prevMQDungeonSetting = currMQDungeonSetting;
|
||||||
|
|
||||||
@@ -166,14 +159,18 @@ void DrawLocationsMenu(WidgetInfo& info) {
|
|||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTricksMenu(WidgetInfo& info) {
|
void UpdateMenuLocations() {
|
||||||
auto ctx = OTRGlobals::Instance->gRandoContext;
|
RandomizerCheckObjects::UpdateImGuiVisibility();
|
||||||
auto randoSettings = Rando::Settings::GetInstance();
|
// todo: this efficently when we build out cvar array support
|
||||||
static ImVec2 cellPadding(8.0f, 8.0f);
|
std::stringstream excludedLocationStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), ""));
|
||||||
bool generating = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0);
|
std::string excludedLocationString;
|
||||||
bool disableEditingRandoSettings = generating || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
|
excludedLocations.clear();
|
||||||
if (tricksDirty) {
|
while (getline(excludedLocationStringStream, excludedLocationString, ',')) {
|
||||||
tricksDirty = false;
|
excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateMenuTricks() {
|
||||||
// RandomizerTricks::UpdateImGuiVisibility();
|
// RandomizerTricks::UpdateImGuiVisibility();
|
||||||
// todo: this efficently when we build out cvar array support
|
// todo: this efficently when we build out cvar array support
|
||||||
std::stringstream enabledTrickStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), ""));
|
std::stringstream enabledTrickStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), ""));
|
||||||
@@ -190,6 +187,17 @@ void DrawTricksMenu(WidgetInfo& info) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawTricksMenu(WidgetInfo& info) {
|
||||||
|
auto ctx = OTRGlobals::Instance->gRandoContext;
|
||||||
|
auto randoSettings = Rando::Settings::GetInstance();
|
||||||
|
static ImVec2 cellPadding(8.0f, 8.0f);
|
||||||
|
bool generating = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0);
|
||||||
|
bool disableEditingRandoSettings = generating || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
|
||||||
|
if (tricksDirty) {
|
||||||
|
tricksDirty = false;
|
||||||
|
UpdateMenuTricks();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
|
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
|
||||||
ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings);
|
ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user