Add statistics queries for the Modern game statistics menu

ModernSession::read_statistics answers JSON requests evaluated from the
almanac: the competitions with results, the winners of every
competition by season, and player statistics per competition and season
or all-time (goals, assists, yellow, second yellow and red cards,
appearances). Replays of postponed league matches are now recorded as
matches of their league and original matchday. Engine texts with code
page 437 umlauts convert to UTF-8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-24 09:16:10 +02:00
1 parent 7c08e39607
commit 7742d014f9
9 files changed
+375 -3

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
// Read-only queries for the game statistics menu of the Modern UI ("Spielstatistik";
// docs/new_engine/statistik.md). They evaluate the football almanac (docs/new_engine/
// almanach.md) of the running career and never change the game.
//
// A request is a JSON object with a `kind`; the answer is {ok: true, ...} or
// {ok: false, error}:
// {kind: "competitions"} leagues and cups with recorded results, per season
// {kind: "winners", competition?} the winners of every competition by season
// {kind: "player_stats", competition, season?, sort?, limit?}
// goals, assists, cards per player in one competition,
// of one season ("2026/27") or all seasons
#include "cli/json.hpp"
#include "modern/game/modern_state.hpp"
namespace bmh::modern {
cli::Json query_statistics(const ModernState& g, const cli::Json& request);
} // namespace bmh::modern