Skip to content

Commit

Permalink
C4StartupOptionsAdvancedConfigDialog: Ignore all levels greater than 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 committed Nov 18, 2024
1 parent f814074 commit 01c8987
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/C4StartupOptionsAdvancedConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,25 @@ class StdCompilerConfigGuiBase : public StdCompiler

NameGuard Name(const char *name) override
{
lastName = name;
if (++level == 1)
if (++level > 2)
{
dialog->ChangeSection(name);
ignore = true;
}
else
{
lastName = name;
if (level == 1)
{
dialog->ChangeSection(name);
}
}
assert(level <= 2);
return StdCompiler::Name(name);
}
void NameEnd(bool breaking = false) override
{
assert(level > 0);
--level;
ignore = false;
return StdCompiler::NameEnd(breaking);
}
protected:
Expand All @@ -85,6 +92,8 @@ class StdCompilerConfigGuiBase : public StdCompiler
template <typename T, typename... Args>
void HandleSettingInternal(T &setting, Args &&... args)
{
if (ignore) return;

try
{
self().HandleSetting(lastName, setting, std::forward<Args>(args)...);
Expand All @@ -97,6 +106,7 @@ class StdCompilerConfigGuiBase : public StdCompiler

std::string lastName;
std::size_t level{0};
bool ignore{false};
};

class StdCompilerConfigGuiRead : public StdCompilerConfigGuiBase<StdCompilerConfigGuiRead>
Expand Down

0 comments on commit 01c8987

Please sign in to comment.