Player12
An open source football management simulator
Loading...
Searching...
No Matches
career_timeline.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 <cstddef>
12#include <cstdint>
13#include <filesystem>
14#include <optional>
15#include <span>
16#include <string>
17#include <string_view>
18#include <vector>
19
20#include "global/types.h"
21#include "model/awards.h"
22#include "model/gamedate.h"
24#include "model/records.h"
27
28class Game;
29class GameData;
30
32enum class TimelineKind : std::uint8_t
33{
34 Appointed = 0,
35 Departed,
36 Trophy,
37 Award,
40 Season,
41 Record,
42 Signing,
43 COUNT
44};
45
47const char* timelineKindKey(TimelineKind kind);
48
51{
54 std::uint16_t season_year = 0;
57 std::string text_key;
58 std::vector<std::string> args;
59
61 std::string text() const;
62};
63
66{
67 const GameData* gamedata = nullptr;
68 std::string manager_name;
69 std::span<const ManagerStint> stints;
70 std::span<const ManagerSeasonLine> seasons;
71 std::span<const ManagerAward> honours;
73 std::span<const AwardRecord> awards;
74 std::span<const TransferRecord> transfers;
76 std::span<const RecordEntry> records;
77 std::span<const SeasonHistoryEntry> history;
78};
79
87{
89inline constexpr std::size_t KEY_SIGNINGS_PER_STINT = 3;
90
91std::vector<TimelineEntry> build(const TimelineSources& sources);
92
97TimelineSources sourcesFor(const Game& game, const GameData& gamedata,
98 std::vector<RecordEntry>& records);
99
104std::string toMarkdown(const TimelineSources& sources,
105 std::span<const TimelineEntry> entries,
106 const GameDateValue& today);
107
109std::string journalFileName(std::string_view manager_name,
110 const GameDateValue& today);
111
116std::optional<std::filesystem::path> writeJournal(
117 const std::string& markdown, const std::filesystem::path& folder,
118 const std::string& file_name);
119} // namespace CareerTimeline
const char * timelineKindKey(TimelineKind kind)
Definition career_timeline.cpp:344
TimelineKind
What happened at a point of the manager's career.
Definition career_timeline.h:33
Singleton class that acts as an in-memory cache for the database state.
Definition gamedata.h:43
Represents the core game state and logic.
Definition game.h:48
The manager's career across every club: spells, trophies, honours, promotions and relegations,...
Definition career_timeline.h:87
std::optional< std::filesystem::path > writeJournal(const std::string &markdown, const std::filesystem::path &folder, const std::string &file_name)
Definition career_timeline.cpp:479
TimelineSources sourcesFor(const Game &game, const GameData &gamedata, std::vector< RecordEntry > &records)
Definition career_timeline.cpp:383
std::string toMarkdown(const TimelineSources &sources, std::span< const TimelineEntry > entries, const GameDateValue &today)
Definition career_timeline.cpp:411
std::vector< TimelineEntry > build(const TimelineSources &sources)
Definition career_timeline.cpp:378
constexpr std::size_t KEY_SIGNINGS_PER_STINT
Definition career_timeline.h:89
std::string journalFileName(std::string_view manager_name, const GameDateValue &today)
Definition career_timeline.cpp:462
Represents a specific date in the game world.
Definition gamedate.h:20
One dated entry of the career timeline.
Definition career_timeline.h:51
std::vector< std::string > args
Definition career_timeline.h:58
std::uint16_t season_year
Definition career_timeline.h:54
GameDateValue date
Definition career_timeline.h:52
std::string text() const
Definition career_timeline.cpp:373
PlayerID player_id
Definition career_timeline.h:56
std::string text_key
Definition career_timeline.h:57
TeamID team_id
Definition career_timeline.h:55
TimelineKind kind
Definition career_timeline.h:53
The saved career facts the timeline is built from.
Definition career_timeline.h:66
std::span< const RecordEntry > records
Definition career_timeline.h:76
std::span< const SeasonHistoryEntry > history
Definition career_timeline.h:77
std::span< const TransferRecord > transfers
Definition career_timeline.h:74
const GameData * gamedata
Definition career_timeline.h:67
std::span< const ManagerSeasonLine > seasons
Definition career_timeline.h:70
std::span< const ManagerStint > stints
Definition career_timeline.h:69
std::span< const AwardRecord > awards
Definition career_timeline.h:73
std::string manager_name
Definition career_timeline.h:68
std::span< const ManagerAward > honours
Definition career_timeline.h:71
uint16_t TeamID
Type alias for Team identifiers.
Definition types.h:18
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21