Player12
An open source football management simulator
Loading...
Searching...
No Matches
awards.h File Reference
#include <array>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "global/types.h"
#include "model/gamedate.h"

Go to the source code of this file.

Classes

struct  AwardRecord
 One honour given in a league. More...
 
struct  AwardPlayerTally
 League matches of a player in a month or season. More...
 
struct  AwardClubTally
 League results of a club against expectation. More...
 
struct  GoalCandidate
 Best goal of the month so far in a league. More...
 
struct  AwardCandidate
 A player considered for an award. More...
 
class  AwardSystem
 Monthly and season honours of every league. More...
 

Namespaces

namespace  Awards
 Selection rules of the league honours.
 

Enumerations

enum class  AwardType : std::uint8_t {
  PlayerOfMonth = 0 , YoungPlayerOfMonth , ManagerOfMonth , GoalOfMonth ,
  PlayerOfSeason , YoungPlayerOfSeason , GoldenBoot , GoldenGlove ,
  TeamOfSeason , ManagerOfSeason , COUNT
}
 League honours (values are persisted). More...
 

Functions

const char * awardTypeKey (AwardType type)
 
float Awards::playerScore (const AwardPlayerTally &tally, bool goalkeeper)
 
std::optional< std::size_t > Awards::bestPlayer (std::span< const AwardCandidate > candidates, std::uint16_t min_minutes, int max_age)
 
std::optional< std::size_t > Awards::goldenBoot (std::span< const AwardCandidate > candidates)
 
std::optional< std::size_t > Awards::goldenGlove (std::span< const AwardCandidate > candidates, std::uint16_t min_minutes)
 
std::array< std::optional< std::size_t >, TEAM_OF_SEASON_SIZE > Awards::teamOfSeason (std::span< const AwardCandidate > candidates, std::uint16_t min_minutes)
 
const char * Awards::slotKey (std::uint8_t slot)
 
std::optional< std::size_t > Awards::bestManager (std::span< const AwardClubTally > clubs, std::uint16_t min_matches)
 
std::uint16_t Awards::seasonMinMinutes (std::span< const AwardCandidate > candidates)
 
float Awards::goalScore (std::uint8_t minute, int own_before, int other_before, bool decisive, int reputation_gap, bool assisted)
 
float Awards::valueMultiplier (std::span< const AwardRecord > honours, const GameDateValue &today)
 

Variables

constexpr std::uint16_t Awards::MONTH_MIN_MINUTES = 270
 
constexpr float Awards::SEASON_MIN_SHARE = 0.5f
 
constexpr int Awards::YOUNG_MAX_AGE = 21
 
constexpr std::uint16_t Awards::MONTH_MIN_MATCHES = 3
 
constexpr std::uint16_t Awards::SEASON_MIN_MATCHES = 10
 
constexpr std::uint8_t Awards::CLEAN_SHEET_MINUTES = 60
 
constexpr std::size_t Awards::TEAM_OF_SEASON_SIZE = 11
 
constexpr float Awards::MAX_VALUE_PREMIUM = 0.25f
 

Enumeration Type Documentation

◆ AwardType

enum class AwardType : std::uint8_t
strong

League honours (values are persisted).

Enumerator
PlayerOfMonth 
YoungPlayerOfMonth 
ManagerOfMonth 
GoalOfMonth 
PlayerOfSeason 
YoungPlayerOfSeason 
GoldenBoot 
GoldenGlove 
TeamOfSeason 
ManagerOfSeason 
COUNT 

Function Documentation

◆ awardTypeKey()

const char * awardTypeKey ( AwardType  type)

Language key naming type (e.g. "AWARD_PLAYER_OF_MONTH").