|
Player12
An open source football management simulator
|
The human manager's career and the market for managers. More...
#include <manager_career.h>
Public Types | |
| using | PositionProvider = std::function< int(TeamID)> |
Public Member Functions | |
| ManagerCareer (std::shared_ptr< GameData > gamedata) | |
| bool | hasProfile () const |
| const ManagerProfile & | getProfile () const |
| bool | isEmployed () const |
| void | createProfile (const ManagerSetup &setup, const GameDateValue &date) |
| void | ensureProfile (TeamID managed_team_id, const GameDateValue &date) |
| const std::vector< ManagerStint > & | getStints () const |
| const std::vector< ManagerSeasonLine > & | getSeasons () const |
| const std::vector< ManagerAward > & | getAwards () const |
| void | ensureClubManagers (const GameDateValue &date, TeamID managed_team_id) |
| const AiManager * | clubManager (TeamID team_id) const |
| const std::vector< AiManager > & | getAiManagers () const |
| const std::vector< Vacancy > & | getVacancies () const |
| const Vacancy * | findVacancy (TeamID team_id) const |
| const std::vector< JobApplication > & | getApplications () const |
| const JobApplication * | findApplication (TeamID team_id) const |
| const std::vector< JobOffer > & | getOffers () const |
| const JobOffer * | findOffer (std::uint32_t offer_id) const |
| ClubVision | visionOf (TeamID team_id) const |
| float | applicationChance (TeamID team_id) const |
| ApplyResult | apply (TeamID team_id, const GameDateValue &date) |
| std::optional< InterviewResult > | interview (TeamID team_id, std::span< const std::uint8_t > answers, const GameDateValue &date, Inbox &inbox) |
| OfferReply | negotiate (std::uint32_t offer_id, std::int64_t weekly_wage, std::uint8_t years, const GameDateValue &date) |
| bool | decline (std::uint32_t offer_id) |
| std::optional< JobOffer > | takeOffer (std::uint32_t offer_id, const GameDateValue &date) |
| void | startJob (TeamID team_id, const ManagerContract &contract, const GameDateValue &date) |
| std::int64_t | leaveJob (DepartureReason reason, const GameDateValue &date, Inbox &inbox) |
| void | payCompensation (TeamID from_club, TeamID to_club, std::int64_t amount, const GameDateValue &date) |
| bool | dismissClubManager (TeamID team_id, const GameDateValue &date, Inbox &inbox) |
| void | recordAward (ManagerAwardKind kind, std::uint16_t start_year, TeamID team_id) |
| void | adjustReputation (float delta) |
| void | addEarnings (std::int64_t amount) |
| void | setInternationalDuty (bool in_charge) |
| bool | hasInternationalDuty () const |
| ManagerContract | contractFor (const JobOffer &offer, const GameDateValue &date) const |
| ManagerContract | initialContract (TeamID team_id, const GameDateValue &date) const |
| CareerDayEvents | onDayAdvanced (const GameDateValue &date, TeamID managed_team_id, float board_confidence, int board_expected_position, const PositionProvider &positions, Inbox &inbox) |
| void | onMatchPlayed (const ManagerMatchEvent &match) |
| bool | onSeasonEnd (const GameDateValue &date, TeamID managed_team_id, int expected_position, float board_confidence, const PositionProvider &positions, std::span< const SeasonHistoryEntry > finished, Inbox &inbox) |
| void | load (const std::shared_ptr< DatabaseConnection > &db_conn) |
| void | save (const std::shared_ptr< DatabaseConnection > &db_conn) const |
Private Member Functions | |
| void | processApplications (const GameDateValue &date, Inbox &inbox, CareerDayEvents &events) |
| void | fillVacancies (const GameDateValue &date, TeamID managed_team_id, Inbox &inbox, CareerDayEvents &events) |
| void | weeklyReviews (const GameDateValue &date, TeamID managed_team_id, Inbox &inbox, CareerDayEvents &events) |
| void | weeklyAiReviews (const GameDateValue &date, TeamID managed_team_id, Inbox &inbox, CareerDayEvents &events) |
| void | weeklyManagerReview (const GameDateValue &date, TeamID managed_team_id, Inbox &inbox, CareerDayEvents &events) |
| void | monthlyReviews (const GameDateValue &date, TeamID managed_team_id, float board_confidence, int board_expected_position, const PositionProvider &positions, Inbox &inbox, CareerDayEvents &events) |
| void | monthlyAiReviews (const std::map< LeagueID, std::vector< std::pair< std::uint8_t, TeamID > > > &league_ranks, const PositionProvider &positions) |
| void | monthlyManagerReview (const GameDateValue &date, TeamID managed_team_id, float board_confidence, int board_expected_position, const PositionProvider &positions, const std::map< LeagueID, std::vector< std::pair< std::uint8_t, TeamID > > > &league_ranks, Inbox &inbox, CareerDayEvents &events) |
| void | reviewAiManagersAtSeasonEnd (const GameDateValue &date, TeamID managed_team_id, const PositionProvider &positions, Inbox &inbox) |
| void | ageManagersAtSeasonEnd (const GameDateValue &date) |
| float | applySeasonHonours (const ManagerSeasonLine &line, std::span< const SeasonHistoryEntry > finished, std::uint16_t start_year) |
| void | dismissAi (AiManager &manager, const GameDateValue &date, Inbox &inbox, TeamID managed_team_id) |
| void | openVacancy (TeamID team_id, const GameDateValue &date) |
| void | leaveJobQuietly (DepartureReason reason, const GameDateValue &date) |
| bool | makeOffer (TeamID team_id, const GameDateValue &date, bool unsolicited, float wage_factor, Inbox &inbox) |
| void | topUpFreePool (const GameDateValue &date) |
| AiManager | generateManager (TeamID team_id, float reputation, const GameDateValue &date) |
| std::uint8_t | leagueTier (TeamID team_id) const |
| std::uint8_t | clubReputation (TeamID team_id) const |
| std::string | clubName (TeamID team_id) const |
| ManagerStint * | currentStint () |
Private Attributes | |
| std::shared_ptr< GameData > | gamedata |
| ManagerProfile | profile |
| std::vector< ManagerStint > | stints |
| std::vector< ManagerSeasonLine > | seasons |
| std::vector< ManagerAward > | awards |
| std::vector< AiManager > | managers |
| std::vector< Vacancy > | vacancies |
| std::vector< JobApplication > | applications |
| std::vector< JobOffer > | offers |
| std::uint32_t | next_manager_id = 1 |
| std::uint32_t | next_offer_id = 1 |
| bool | national_duty = false |
The human manager's career and the market for managers.
Owned by Game next to the world simulation. Every club has a manager: the human at the managed club, an AI manager elsewhere (generated for worlds that have none). AI managers lose their jobs when results stay below the board's expectation (weekly hazard during the season plus a season-end review); a vacancy stays open for a few weeks and is then filled by the free AI manager whose reputation fits the club best. The human applies for vacancies, is interviewed, receives offers (also unsolicited ones when overachieving or out of work for long), negotiates the contract, resigns, or is dismissed by the board. Out of work, time keeps running and the reputation fades slowly. All randomness comes from the Managers stream.
| using ManagerCareer::PositionProvider = std::function<int(TeamID)> |
League position of a club in the current table (0 if unknown).
|
explicit |
| void ManagerCareer::addEarnings | ( | std::int64_t | amount | ) |
Wages of a job outside the club game (a national team).
| void ManagerCareer::adjustReputation | ( | float | delta | ) |
Results elsewhere (a national team) move the reputation (1-100).
|
private |
| float ManagerCareer::applicationChance | ( | TeamID | team_id | ) | const |
Chance of an interview invitation from team_id's board.
| ApplyResult ManagerCareer::apply | ( | TeamID | team_id, |
| const GameDateValue & | date | ||
| ) |
|
private |
|
private |
|
private |
| ManagerContract ManagerCareer::contractFor | ( | const JobOffer & | offer, |
| const GameDateValue & | date | ||
| ) | const |
Contract agreed through offer, starting on date.
| void ManagerCareer::createProfile | ( | const ManagerSetup & | setup, |
| const GameDateValue & | date | ||
| ) |
Creates the human manager from the new-game step.
|
private |
| bool ManagerCareer::decline | ( | std::uint32_t | offer_id | ) |
|
private |
| bool ManagerCareer::dismissClubManager | ( | TeamID | team_id, |
| const GameDateValue & | date, | ||
| Inbox & | inbox | ||
| ) |
The board of team_id dismisses its AI manager (results, a takeover, a better candidate): a vacancy opens. False without an AI manager.
| void ManagerCareer::ensureClubManagers | ( | const GameDateValue & | date, |
| TeamID | managed_team_id | ||
| ) |
Gives every club without one an AI manager and fills the free pool.
| void ManagerCareer::ensureProfile | ( | TeamID | managed_team_id, |
| const GameDateValue & | date | ||
| ) |
A profile for careers started before the manager step existed.
|
private |
| const JobApplication * ManagerCareer::findApplication | ( | TeamID | team_id | ) | const |
| const JobOffer * ManagerCareer::findOffer | ( | std::uint32_t | offer_id | ) | const |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| ManagerContract ManagerCareer::initialContract | ( | TeamID | team_id, |
| const GameDateValue & | date | ||
| ) | const |
Contract of a first appointment from the club choice.
| std::optional< InterviewResult > ManagerCareer::interview | ( | TeamID | team_id, |
| std::span< const std::uint8_t > | answers, | ||
| const GameDateValue & | date, | ||
| Inbox & | inbox | ||
| ) |
Answers the four interview questions (one option index per topic). The board decides on the spot: an offer (terms shaped by the answers) or a polite refusal. nullopt without an interview invitation.
| bool ManagerCareer::isEmployed | ( | ) | const |
|
private |
| std::int64_t ManagerCareer::leaveJob | ( | DepartureReason | reason, |
| const GameDateValue & | date, | ||
| Inbox & | inbox | ||
| ) |
The human leaves the managed club: the spell closes and the club gets a vacancy. A sacked manager receives the remaining wages (at most a year), booked on the club's ledger and announced in the inbox. Returns them.
|
private |
Closes the spell and opens the vacancy, without news or severance.
| void ManagerCareer::load | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) |
|
private |
|
private |
|
private |
|
private |
| OfferReply ManagerCareer::negotiate | ( | std::uint32_t | offer_id, |
| std::int64_t | weekly_wage, | ||
| std::uint8_t | years, | ||
| const GameDateValue & | date | ||
| ) |
Counter-proposal on wage and length.
| CareerDayEvents ManagerCareer::onDayAdvanced | ( | const GameDateValue & | date, |
| TeamID | managed_team_id, | ||
| float | board_confidence, | ||
| int | board_expected_position, | ||
| const PositionProvider & | positions, | ||
| Inbox & | inbox | ||
| ) |
Offers, applications, vacancies, AI sackings and reputation.
| void ManagerCareer::onMatchPlayed | ( | const ManagerMatchEvent & | match | ) |
A competitive match: AI job security, the human's record.
| bool ManagerCareer::onSeasonEnd | ( | const GameDateValue & | date, |
| TeamID | managed_team_id, | ||
| int | expected_position, | ||
| float | board_confidence, | ||
| const PositionProvider & | positions, | ||
| std::span< const SeasonHistoryEntry > | finished, | ||
| Inbox & | inbox | ||
| ) |
Season end: season line, honours, reputation, ageing and the boards' season reviews of AI managers. finished holds the history rows of the season that just ended, positions the final league positions (captured before promotion and relegation). An expiring contract is renewed while the board is content; returns true when it ran out.
|
private |
| void ManagerCareer::payCompensation | ( | TeamID | from_club, |
| TeamID | to_club, | ||
| std::int64_t | amount, | ||
| const GameDateValue & | date | ||
| ) |
The club that hired the manager away pays his former club the release compensation of his contract (both ledgers).
|
private |
| void ManagerCareer::recordAward | ( | ManagerAwardKind | kind, |
| std::uint16_t | start_year, | ||
| TeamID | team_id | ||
| ) |
Adds an honour decided elsewhere (e.g. a monthly award).
|
private |
| void ManagerCareer::save | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) | const |
|
inline |
In charge of a national team: the name does not fade out of work.
| void ManagerCareer::startJob | ( | TeamID | team_id, |
| const ManagerContract & | contract, | ||
| const GameDateValue & | date | ||
| ) |
The human takes charge of team_id: a new spell starts, the club's vacancy closes and its AI manager (if any) becomes available.
| std::optional< JobOffer > ManagerCareer::takeOffer | ( | std::uint32_t | offer_id, |
| const GameDateValue & | date | ||
| ) |
Removes and returns an offer that is still valid on date.
|
private |
| ClubVision ManagerCareer::visionOf | ( | TeamID | team_id | ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |