mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-16 21:38:07 -04:00
adjust closed forest and starting age settings for edge cases (#2421)
This commit is contained in:
+22
-1
@@ -245,11 +245,17 @@ namespace UIWidgets {
|
||||
}
|
||||
}
|
||||
|
||||
bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue) {
|
||||
bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue, bool disabled, const char* disabledTooltipText, uint8_t disabledValue) {
|
||||
bool changed = false;
|
||||
if (FirstTimeValue <= 0) {
|
||||
FirstTimeValue = 0;
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
||||
}
|
||||
|
||||
uint8_t selected = CVarGetInteger(name, FirstTimeValue);
|
||||
uint8_t DefaultValue = selected;
|
||||
std::string comboName = std::string("##") + std::string(name);
|
||||
@@ -266,6 +272,21 @@ namespace UIWidgets {
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
ImGui::PopStyleVar(1);
|
||||
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
|
||||
ImGui::SetTooltip("%s", disabledTooltipText);
|
||||
}
|
||||
ImGui::PopItemFlag();
|
||||
|
||||
if (disabledValue >= 0 && selected != disabledValue) {
|
||||
CVarSetInteger(name, disabledValue);
|
||||
changed = true;
|
||||
SohImGui::RequestCvarSaveOnNextTick();
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user