diff --git a/src/views/settings/view_protection_settings.cpp b/src/views/settings/view_protection_settings.cpp index 29cd1262..a99942d6 100644 --- a/src/views/settings/view_protection_settings.cpp +++ b/src/views/settings/view_protection_settings.cpp @@ -2,8 +2,16 @@ namespace big { + static inline void set_all_protections(bool state) + { + for (size_t i = (size_t)&g.protections; i <= (size_t) & (g.protections.kick_rejoin); i++) + *(bool*)i = state; + } + void view::protection_settings() { + auto initial_protections = g.protections; + ImGui::BeginGroup(); ImGui::Checkbox("BOUNTY"_T.data(), &g.protections.script_events.bounty); ImGui::Checkbox("CEO_MONEY"_T.data(), &g.protections.script_events.ceo_money); @@ -47,6 +55,17 @@ namespace big ImGui::Checkbox("ADMIN_CHECK"_T.data(), &g.protections.admin_check); ImGui::Checkbox("Kick Rejoin", &g.protections.kick_rejoin); ImGui::EndGroup(); - } + ImGui::SeparatorText("Options"); + ImGui::BeginGroup(); + if (ImGui::Button("Enable All Protections")) + set_all_protections(true); + ImGui::SameLine(); + if (ImGui::Button("Disable All Protections")) + set_all_protections(false); + ImGui::SameLine(); + if (ImGui::Button("Reset Protections")) + g.protections = initial_protections; + ImGui::EndGroup(); + }; }