Player12
An open source football management simulator
Loading...
Searching...
No Matches
standings.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <cstdint>
12#include <string>
13#include <vector>
14
15#include "global/types.h"
16
17class Calendar;
18class GameData;
19class League;
20
26{
28 uint16_t position = 0;
29 uint16_t played = 0;
30 uint16_t won = 0;
31 uint16_t drawn = 0;
32 uint16_t lost = 0;
33 uint16_t goals_for = 0;
34 uint16_t goals_against = 0;
35 int32_t goal_difference = 0;
36 uint16_t points = 0;
38 std::string form;
39};
40
41namespace Standings
42{
43constexpr uint16_t POINTS_FOR_WIN = 3;
44constexpr uint16_t POINTS_FOR_DRAW = 1;
45constexpr size_t FORM_LENGTH = 5;
46
57std::vector<StandingRow> compute(const League& league, const Calendar& calendar,
58 const GameData& gamedata);
59} // namespace Standings
Manages the match calendar for a season.
Definition calendar.h:133
Singleton class that acts as an in-memory cache for the database state.
Definition gamedata.h:43
Represents a football league containing teams and a leaderboard.
Definition league.h:41
Run-in maths of a league table: which outcomes are mathematically decided (title, promotion,...
Definition standings.h:42
constexpr size_t FORM_LENGTH
Definition standings.h:45
std::vector< StandingRow > compute(const League &league, const Calendar &calendar, const GameData &gamedata)
Computes a league table from the played league fixtures.
Definition standings.cpp:42
constexpr uint16_t POINTS_FOR_WIN
Definition standings.h:43
constexpr uint16_t POINTS_FOR_DRAW
Definition standings.h:44
One row of a league table, derived from played league fixtures.
Definition standings.h:26
uint16_t goals_for
Definition standings.h:33
int32_t goal_difference
Definition standings.h:35
uint16_t drawn
Definition standings.h:31
TeamID team_id
Definition standings.h:27
uint16_t played
Definition standings.h:29
std::string form
Definition standings.h:38
uint16_t won
Definition standings.h:30
uint16_t position
Definition standings.h:28
uint16_t goals_against
Definition standings.h:34
uint16_t lost
Definition standings.h:32
uint16_t points
Definition standings.h:36
uint16_t TeamID
Type alias for Team identifiers.
Definition types.h:18