From 0b6d2c96c2aa3c366c027a331dbc448e0726d482 Mon Sep 17 00:00:00 2001 From: Guffawaffle Date: Sat, 17 Oct 2026 23:42:19 -0500 Subject: [PATCH] Resolve blank daily faction filters to an explicit default --- docs/DAILY_FACTION_BULK_CLAIM.md | 16 ++++++++++++++++ example_community_patch_settings_en.toml | 4 ++-- mods/src/config.cc | 24 +++++++++++++++++++----- mods/src/defaultconfig.h | 2 +- 4 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 docs/DAILY_FACTION_BULK_CLAIM.md diff --git a/docs/DAILY_FACTION_BULK_CLAIM.md b/docs/DAILY_FACTION_BULK_CLAIM.md new file mode 100644 index 000000000..342471d75 --- /dev/null +++ b/docs/DAILY_FACTION_BULK_CLAIM.md @@ -0,0 +1,16 @@ +# Daily faction bulk-claim configuration + +`ui.daily_bulk_claim_factions` defaults explicitly to `"federation,klingon,romulan"`. + +| Config value | Main-faction dailies eligible for bulk claim | +| --- | --- | +| Missing, empty or whitespace-only | The default: all three factions | +| `"federation,romulan"` | Federation and Romulan | +| `"none"` | None of the three | + +Other dailies remain eligible. Use `none` by itself. Restart after editing TOML. + +On upgrade, existing blank configurations keep their all-factions behavior. +The loader now resolves blank to the explicit default before populating the +runtime faction list and generated configuration values. `none` is a new explicit +opt-out; it does not share the blank/default representation. diff --git a/example_community_patch_settings_en.toml b/example_community_patch_settings_en.toml index fdb54c7d1..a32f9286f 100644 --- a/example_community_patch_settings_en.toml +++ b/example_community_patch_settings_en.toml @@ -787,8 +787,8 @@ extend_chest_purchase_max = 160 # Subgroup: Daily Goals # --------------------- -# Comma-separated factions (federation, klingon, romulan) for which the Daily Goals bulk-claim toggle applies; leave blank to preserve the game's default behaviour -daily_bulk_claim_factions = "" +# Comma-separated factions for Daily Goals bulk claim. Missing or blank uses the default below; "none" skips all three main-faction dailies. Other dailies remain eligible. +daily_bulk_claim_factions = "federation,klingon,romulan" # Force the Daily Goals Claim All toggle back on the first time the screen is shown each session daily_bulk_claim_toggle_default_on = false diff --git a/mods/src/config.cc b/mods/src/config.cc index 3fc11d19d..09c628281 100644 --- a/mods/src/config.cc +++ b/mods/src/config.cc @@ -595,15 +595,21 @@ void parse_faction_filter(std::string_view value, std::vector& fact static constexpr std::array kKnownFactions{"federation", "klingon", "romulan"}; factions.clear(); + bool none = false; for (const auto& token : StrSplit(std::string(value), ',')) { const auto stripped = StripAsciiWhitespace(token); - if (stripped.empty()) continue; + if (stripped.empty()) + continue; - auto lowered = AsciiStrToLower(stripped); + auto lowered = AsciiStrToLower(std::string(stripped)); + if (lowered == "none") { + none = true; + continue; + } if (std::ranges::find(kKnownFactions, lowered) == kKnownFactions.end()) { spdlog::warn("Unrecognised faction '{}' in daily_bulk_claim_factions; expected one of: federation, klingon, " - "romulan. Ignoring.", + "romulan, or none by itself. Ignoring.", stripped); continue; } @@ -612,13 +618,21 @@ void parse_faction_filter(std::string_view value, std::vector& fact factions.emplace_back(std::move(lowered)); } } + if (none) { + if (!factions.empty()) + spdlog::warn("daily_bulk_claim_factions: none overrides named factions; use none by itself."); + factions = {"none"}; + } } void read_daily_bulk_claim_factions(toml::table& config, toml::table& new_config, std::vector& factions, std::string_view default_value, bool write_log) { - const auto value = - config["ui"]["daily_bulk_claim_factions"].value().value_or(std::string(default_value)); + auto value = config["ui"]["daily_bulk_claim_factions"].value().value_or(std::string(default_value)); + // Blank has the same meaning as an omitted setting. Materialize the default + // for both gameplay and generated config values; none is the explicit opt-out. + if (StripAsciiWhitespace(value).empty()) + value = std::string(default_value); parse_faction_filter(value, factions); new_config.emplace("ui", toml::table()); diff --git a/mods/src/defaultconfig.h b/mods/src/defaultconfig.h index 3b9f855d0..ed8a1ea06 100644 --- a/mods/src/defaultconfig.h +++ b/mods/src/defaultconfig.h @@ -269,7 +269,7 @@ namespace UI constexpr bool auto_confirm_ft_upgrade = false; constexpr bool auto_confirm_reveal_ability = false; constexpr bool auto_open_bulk_claim_flyout = false; - constexpr const char* daily_bulk_claim_factions = ""; + constexpr const char* daily_bulk_claim_factions = "federation,klingon,romulan"; constexpr bool daily_bulk_claim_toggle_default_on = false; constexpr bool only_show_first_popup = false; constexpr bool disable_escape_exit = true;