Reduce the career's game options to the ones that matter; keep leagues in a running game

The game page of a Dreierpack career offers five options (winter
postponements and their cap, indoor tournaments, the two transfer-news
switches). The cells of the original's presentation, the multi-player and
autosave cells and the switches that take leagues out of a running game are
no longer shown, and settings.commit refuses them. The sound page and the
marking automation are hidden in a career. A mailbox text cut inside a
multi-byte character no longer breaks the news read. modern_live_dump can
commit options and reports their effect.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-14 09:32:01 +01:00
1 parent 6d70a48be8
commit 1de09ba8a6
7 files changed
+135 -12

No files matched your search

+20
View File
@@ -8658,6 +8658,21 @@ std::vector<std::pair<std::string, ui::MailboxMessage>> ui_mailbox(const ModernS
std::snprintf(key, sizeof key, "message:%u-%08x", unsigned(m.date_counter), hash);
std::string id = key;
if (const int n = seen[id]++; n > 0) id += "-" + std::to_string(n + 1);
// A mailbox entry has a fixed size: a long text can end inside a multi-byte character of
// a world name. Such a tail (and any other ill-formed byte) is dropped, so the read
// always carries valid UTF-8; the id above stays the one of the stored bytes.
std::string clean;
clean.reserve(m.text.size());
for (size_t i = 0; i < m.text.size();) {
const unsigned char c = static_cast<unsigned char>(m.text[i]);
const size_t length = c < 0x80 ? 1 : (c >> 5) == 0x6 ? 2 : (c >> 4) == 0xe ? 3 : (c >> 3) == 0x1e ? 4 : 0;
bool whole = length != 0 && i + length <= m.text.size();
for (size_t k = 1; whole && k < length; ++k)
whole = (static_cast<unsigned char>(m.text[i + k]) & 0xc0) == 0x80;
if (whole) clean.append(m.text, i, length), i += length;
else ++i;
}
m.text = std::move(clean);
out.emplace_back(std::move(id), std::move(m));
}
return out;
@@ -10630,6 +10645,11 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
const auto code = ui_text(edit, "code");
const auto *value = ui_field(edit, "value");
const int index = ui_setting_index(code);
// The interface offers only the options of the season itself; the original's
// presentation cells and the switches that take leagues out of a running game
// are not changed through this command.
static const std::set<std::string> offered{"P5", "Q5", "J8", "H6", "I6"};
if (!offered.contains(code)) throw FormatError("Diese Einstellung wird nicht angeboten.");
if (index < 0 || !seen.insert(index).second || !value || !value->integer() || *value->integer() < 0 || *value->integer() > 255)
throw FormatError("invalid_setting_edit");
const auto address = ::bmh::layout::LeaguePresentationOptions + uint32_t(index);