Player12
An open source football management simulator
Loading...
Searching...
No Matches
board.h File Reference
#include <array>
#include <cstdint>
#include <optional>
#include "global/types.h"

Go to the source code of this file.

Classes

struct  BoardState
 The board's view of the manager of the managed club. More...
 
struct  ProjectQuote
 Cost, duration and size of a project for one club. More...
 
struct  ProjectRequestContext
 What the board weighs when a project is requested. More...
 

Namespaces

namespace  BoardModel
 

Enumerations

enum class  BoardObjective : std::uint8_t {
  WinLeague = 0 , TopFour , TopHalf , MidTable ,
  AvoidRelegation
}
 Season objective set from the club's expected finish (persisted). More...
 
enum class  CupObjective : std::uint8_t {
  None = 0 , QuarterFinal , SemiFinal , Final ,
  Win
}
 How far the board expects the domestic cup run to go (persisted). More...
 
enum class  FinanceObjective : std::uint8_t { WithinWageBudget = 0 , BreakEven }
 What the board expects from the books (persisted). More...
 
enum class  ObjectiveGrade : std::uint8_t { Exceeded = 0 , Met , Missed , Failed }
 How one objective went, or is going (values are persisted). More...
 
enum class  BoardReviewOutcome : std::uint8_t { Satisfied , Warning , Dismissed }
 Outcome of a monthly board review. More...
 
enum class  FacilityProjectType : std::uint8_t { TrainingGround = 0 , MedicalCentre , StadiumExpansion , COUNT }
 Facility project (values are persisted). More...
 
enum class  ProjectVerdict : std::uint8_t {
  Approved = 0 , AlreadyRunning , TooManyProjects , Cooldown ,
  AtMaximum , NotNeeded , LowConfidence , CannotAfford
}
 The board's answer to a project request. More...
 

Functions

BoardObjective BoardModel::objectiveFor (int expected_position, int league_size)
 
std::uint8_t BoardModel::targetPosition (BoardObjective objective, int league_size)
 
const char * BoardModel::objectiveKey (BoardObjective objective)
 
float BoardModel::expectedPoints (float own_strength, float opponent_strength, bool home)
 
void BoardModel::recordMatch (BoardState &state, float points, float expected_points)
 
BoardReviewOutcome BoardModel::monthlyReview (BoardState &state, int position, int league_size, bool negative_balance, bool over_wage_budget, bool in_season)
 
void BoardModel::seasonReview (BoardState &state, int final_position)
 
void BoardModel::adjustConfidence (BoardState &state, float delta)
 
CupObjective BoardModel::cupObjectiveFor (BoardObjective objective, int tier)
 
FinanceObjective BoardModel::financeObjectiveFor (float tight_budget, std::int64_t balance)
 
std::uint8_t BoardModel::youthTargetFor (float youth_focus)
 
const char * BoardModel::cupObjectiveKey (CupObjective objective)
 
const char * BoardModel::financeObjectiveKey (FinanceObjective objective)
 
const char * BoardModel::youthTargetKey (std::uint8_t target)
 
const char * BoardModel::targetStatusKey (ObjectiveGrade grade)
 
ObjectiveGrade BoardModel::gradeCup (CupObjective objective, std::optional< int > rounds_left, bool won, bool still_in)
 
ObjectiveGrade BoardModel::gradeLeague (int target_position, int position, int league_size)
 
ObjectiveGrade BoardModel::gradeFinances (FinanceObjective objective, std::int64_t balance, std::int64_t start_balance, bool over_wage_budget)
 
ObjectiveGrade BoardModel::gradeYouth (std::uint8_t target, int young_regulars)
 
ProjectQuote BoardModel::quoteProject (FacilityProjectType type, std::uint8_t current_level, std::uint32_t capacity, std::uint8_t reputation, double season_income, std::uint32_t seats)
 
ProjectVerdict BoardModel::reviewProject (const ProjectQuote &quote, const ProjectRequestContext &context)
 
float BoardModel::medicalLayoffMultiplier (std::uint8_t medical_level)
 
const char * BoardModel::projectTypeKey (FacilityProjectType type)
 
const char * BoardModel::projectVerdictKey (ProjectVerdict verdict)
 

Variables

constexpr int BoardModel::PROJECT_COOLDOWN_DAYS = 90
 
constexpr int BoardModel::MAX_RUNNING_PROJECTS = 2
 
constexpr int BoardModel::PROJECT_CASH_RESERVE_WEEKS = 16
 
constexpr float BoardModel::PROJECT_MIN_CONFIDENCE = 45.0f
 
constexpr std::uint32_t BoardModel::MIN_EXPANSION_SEATS = 1'000
 
constexpr std::uint32_t BoardModel::MAX_STADIUM_CAPACITY = 100'000
 

Enumeration Type Documentation

◆ BoardObjective

enum class BoardObjective : std::uint8_t
strong

Season objective set from the club's expected finish (persisted).

Enumerator
WinLeague 
TopFour 
TopHalf 
MidTable 
AvoidRelegation 

◆ BoardReviewOutcome

enum class BoardReviewOutcome : std::uint8_t
strong

Outcome of a monthly board review.

Enumerator
Satisfied 
Warning 
Dismissed 

◆ CupObjective

enum class CupObjective : std::uint8_t
strong

How far the board expects the domestic cup run to go (persisted).

Enumerator
None 

The cup is a bonus.

QuarterFinal 
SemiFinal 
Final 
Win 

◆ FacilityProjectType

enum class FacilityProjectType : std::uint8_t
strong

Facility project (values are persisted).

Enumerator
TrainingGround 

+training facilities.

MedicalCentre 

Shorter injury layoffs.

StadiumExpansion 

More seats; part of the ground closed meanwhile.

COUNT 

◆ FinanceObjective

enum class FinanceObjective : std::uint8_t
strong

What the board expects from the books (persisted).

Enumerator
WithinWageBudget 

Wages within budget, cash never negative.

BreakEven 

End the season with at least the cash it began.

◆ ObjectiveGrade

enum class ObjectiveGrade : std::uint8_t
strong

How one objective went, or is going (values are persisted).

Enumerator
Exceeded 
Met 
Missed 
Failed 

◆ ProjectVerdict

enum class ProjectVerdict : std::uint8_t
strong

The board's answer to a project request.

Enumerator
Approved 
AlreadyRunning 

A project of this type is under way.

TooManyProjects 

Two projects at once at most.

Cooldown 

Refused recently; ask again later.

AtMaximum 

Nothing left to build.

NotNeeded 

Far beyond what the club's stature needs.

LowConfidence 

The board does not trust the manager enough.

CannotAfford 

The cost would eat into the cash reserve.