live_league_table is shared by the recording and the paused live state; a paused league match now reports its league with the running scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
3.4 KiB
C++
58 lines
3.4 KiB
C++
// 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 <vector>
|
|
|
|
#include "cli/json.hpp"
|
|
#include "modern/game/modern_state.hpp"
|
|
|
|
namespace bmh::modern {
|
|
|
|
cli::Json query_statistics(const ModernState& g, const cli::Json& request);
|
|
|
|
// The almanac screen of the Modern UI (DataSource::read_almanac), the request kinds of its demo:
|
|
// {kind: "index"} years with matches, their number, first and last date
|
|
// {kind: "calendar", year} the match days of a year with counts and highlights
|
|
// {kind: "day", date} all matches of a day (ISO date)
|
|
// {kind: "match", id} one match ("match:<season start year>-<index>")
|
|
// A match: date, season, competition, round, both sides (manager if human), result split into
|
|
// regulation / extra time / penalties, referee, attendance, weather, line-ups, events.
|
|
cli::Json query_almanac(const ModernState& g, const cli::Json& request);
|
|
|
|
// The statistics screen of the Modern UI (DataSource::read_statistics) with the filters of its demo
|
|
// (section 0-8, category, country, winner_country, absolute, curves), from the almanac: eternal
|
|
// table, national tournaments (winners, scorers, history), series and records, winners by season,
|
|
// the own club per five minutes. Views without a record yet answer available: false, reason
|
|
// not_recorded (title chances, transfers, weekly curves, season finances).
|
|
cli::Json query_statistics_screen(const ModernState& g, int manager, const cli::Json& request);
|
|
|
|
// The live ticker (DataSource::read_live): the matches recorded between two day counters (the last
|
|
// kickoff) in the fixture form of the interface: the matches of human managers (at most four)
|
|
// with their owners, frames in minute order (kickoff, every event, half time, the end) with
|
|
// score, chances, cards and players per match, the event lines, and the other matches of the
|
|
// day as the conference. source: "engine-recording".
|
|
cli::Json live_fixture(const ModernState& g, uint32_t after_date, uint32_t until_date, uint64_t revision);
|
|
|
|
// A game of a matchday under way: runtime teams and goals so far.
|
|
struct LiveGame { int home = 0, away = 0, home_goals = 0, away_goals = 0; };
|
|
// The live table of a league during matchday `round` (1-based): the table before it plus the
|
|
// given games. {competitionId, name, round, rows: [{rank, previousRank, team, played, won,
|
|
// drawn, lost, goalsFor, goalsAgainst, points}]}.
|
|
cli::Json live_league_table(const ModernState& g, int league, int round, const std::vector<LiveGame>& games);
|
|
|
|
// All recorded matches with from_date <= date < until_date in the almanac form (the matches of a kickoff).
|
|
cli::Json almanac_matches_between(const ModernState& g, uint32_t from_date, uint32_t until_date);
|
|
|
|
} // namespace bmh::modern
|