Modern UI contract: press journal for business events

Business events cannot be derived from the almanac later, so a saved
journal notes them once: squad changes of the human clubs at a kickoff
(signed, free, sold, contract ended; clubs compared by identity across
the season's new draw positions), toto settlements, season change,
contract renewals and resigning. The news read merges it with the
almanac events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 18:22:50 +01:00
1 parent 9c436c753e
commit 651d262546
9 files changed
+318 -4

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
// The press journal of a Modern career (docs/new_engine/ui-anbindung.md, read "news"; the
// interface's press contract is docs/new_ui/integration/PRESS.md).
//
// Match events come from the almanac (statistics.hpp, query_news). Business events cannot be
// derived later, so they are noted once when they happen and saved with the career
// (ModernState::press): their id stays the same on every read, a deleted article is never
// produced again. Noting draws no random number and changes nothing else of the game.
//
// Sources:
// - a kickoff (session.advance, also live): the squads of the human clubs before and after
// give transfer.signed (with fromClub, or transfer.free from the pool), transfer.sold
// (toClub) and contract.ended (to the pool); a new toto settlement gives toto.win /
// toto.loss; a season change career.season_finished and career.season_started;
// - confirmed commands: contract.extended (contract.offer), career.manager_resigned.
// Fees are not known from the squads: the transfer events carry no fee (the renderer's
// fee-undisclosed variants).
#include <string>
#include "cli/json.hpp"
#include "modern/game/modern_state.hpp"
namespace bmh::modern {
// Notes an event of `team` (contract team id) on today's date with its facts.
void note_press(ModernState& g, const std::string& type, const std::string& team, cli::Json data);
// The events of the kickoff from `before` to `g` (see above).
void journal_advance(ModernState& g, const ModernState& before);
// The journal's events of `team` with from <= date <= until (ISO), in the form of query_news.
cli::Json::Array journal_events(const ModernState& g, const std::string& team, const std::string& from,
const std::string& until);
// A team / a player as the press facts name them ({id, name, kind} / {id, name}).
cli::Json press_team(const ModernState& g, int team);
cli::Json press_player(const ModernState& g, int player);
} // namespace bmh::modern