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
12 changes: 2 additions & 10 deletions src/Features/LightLimitFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
static constexpr uint CLUSTER_MAX_LIGHTS = 128;
static constexpr uint MAX_LIGHTS = 1024;

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
LightLimitFix::Settings,
EnableContactShadows,
LightsVisualisationMode)

void LightLimitFix::DrawSettings()
{
auto shaderCache = globals::shaderCache;
Expand Down Expand Up @@ -170,19 +165,16 @@ void LightLimitFix::SetupResources()
}
}

void LightLimitFix::LoadSettings(json& o_json)
void LightLimitFix::LoadSettings(json&)
{
settings = o_json;
}

void LightLimitFix::SaveSettings(json& o_json)
void LightLimitFix::SaveSettings(json&)
{
o_json = settings;
}

void LightLimitFix::RestoreDefaultSettings()
{
settings = {};
}
Comment on lines 176 to 178

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

RestoreDefaultSettings may need to re-initialize settings to its defaults.

With LoadSettings/SaveSettings removed, RestoreDefaultSettings is the only explicit reset path. If a user changes EnableLightsVisualisation or LightsVisualisationMode via the UI (lines 25, 32) and then triggers a "restore defaults" action, this empty body will silently do nothing—leaving the runtime settings struct in its modified state.

Consider resetting the struct here:

Suggested fix
 void LightLimitFix::RestoreDefaultSettings()
 {
+	settings = {};
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
void LightLimitFix::RestoreDefaultSettings()
{
settings = {};
}
void LightLimitFix::RestoreDefaultSettings()
{
settings = {};
}
🤖 Prompt for AI Agents
In `@src/Features/LightLimitFix.cpp` around lines 176 - 178,
RestoreDefaultSettings currently does nothing so runtime 'settings' isn't reset
when the user chooses "restore defaults"; update RestoreDefaultSettings (in
class LightLimitFix) to reinitialize the settings struct to its default state
(the same defaults used when settings were first constructed), ensuring fields
like EnableLightsVisualisation and LightsVisualisationMode are set back to their
default values; locate the settings instance used by LightLimitFix and assign a
fresh/default-constructed settings object or explicitly set each default field
to match initial defaults so UI changes are reverted at runtime.


RE::NiNode* GetParentRoomNode(RE::NiAVObject* object)
Expand Down
1 change: 0 additions & 1 deletion src/Features/LightLimitFix.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ struct LightLimitFix : OverlayFeature

struct Settings
{
bool EnableContactShadows = false;
bool EnableLightsVisualisation = false;
uint LightsVisualisationMode = 0;
};
Expand Down