Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Menu/FeatureListRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "SettingsOverrideManager.h"
#include "State.h"
#include "Util.h"
#include "WeatherVariableRegistry.h"

namespace
{
Expand Down Expand Up @@ -418,6 +419,20 @@ void FeatureListRenderer::DrawMenuVisitor::RenderFeatureSettingsTab(Feature* fea
ImGui::Text("Enable the feature above to access its configuration options.");
} else {
if (isLoaded) {
auto weatherRegistry = WeatherVariables::GlobalWeatherRegistry::GetSingleton();
if (weatherRegistry->HasWeatherSupport(feat->GetShortName())) {
bool paused = weatherRegistry->IsFeaturePaused(feat->GetShortName());
if (ImGui::Checkbox("Pause Weather Overrides", &paused)) {
weatherRegistry->SetFeaturePaused(feat->GetShortName(), paused);
}
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text(
"Temporarily disable weather-based setting adjustments for this feature.\n"
"This state is not saved.");
}
ImGui::Separator();
}

ImVec2 cursorPosBefore = ImGui::GetCursorPos();
feat->DrawSettings();
ImVec2 cursorPosAfter = ImGui::GetCursorPos();
Expand Down
19 changes: 19 additions & 0 deletions src/WeatherVariableRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,30 @@ namespace WeatherVariables

void UpdateFeatureFromWeathers(const std::string& featureName, const json& currWeather, const json& nextWeather, float lerpFactor)
{
if (IsFeaturePaused(featureName)) {
return;
}

auto* registry = GetFeatureRegistry(featureName);
if (registry) {
registry->LerpAllVariables(currWeather, nextWeather, lerpFactor);
}
}

bool IsFeaturePaused(const std::string& featureName)
{
auto it = pausedFeatures.find(featureName);
if (it != pausedFeatures.end()) {
return it->second;
}
return false;
}

void SetFeaturePaused(const std::string& featureName, bool paused)
{
pausedFeatures[featureName] = paused;
}

void SaveFeatureToJson(const std::string& featureName, json& j) const
{
auto it = featureRegistries.find(featureName);
Expand All @@ -360,5 +378,6 @@ namespace WeatherVariables
GlobalWeatherRegistry& operator=(const GlobalWeatherRegistry&) = delete;

std::map<std::string, std::unique_ptr<FeatureWeatherRegistry>> featureRegistries;
std::map<std::string, bool> pausedFeatures;
};
}