72 const std::vector<const Player*>& candidates);
165 void setReserves(
const std::vector<const Player*>& subs);
174 std::span<const Player* const> candidates);
187 const std::vector<const Player*>&
getReserves()
const;
243 std::vector<const Player*>
starters()
const;
271 const std::vector<PlayerID>& allPlayerIDs,
Singleton class that acts as an in-memory cache for the database state.
Definition gamedata.h:43
Manages the starting XI and reserves of a team.
Definition lineup.h:85
void clear()
Clears the outfield players and goalkeeper.
Definition lineup.h:277
bool removePlayer(PlayerID playerID)
Drops every reference to a player: goalkeeper, outfield slot, bench and set-piece designations....
Definition lineup.cpp:80
const Player * goalkeeper
Definition lineup.h:285
Lineup()
Constructs a Lineup object.
Definition lineup.cpp:22
void setDesignations(const SetPieceDesignations &designations)
Replaces every designation (persistence).
Definition lineup.cpp:421
bool isStarter(PlayerID playerID) const
True when the player is in the starting XI.
Definition lineup.cpp:436
PlayerID getDesignated(SetPieceDuty duty) const
Designated player of a duty (0 = automatic).
Definition lineup.cpp:396
std::vector< PositionedPlayer > outfield_players
Definition lineup.h:286
const SetPieceDesignations & getDesignations() const
Every designation, indexed by SetPieceDuty.
Definition lineup.cpp:416
void setGoalkeeper(const Player *gk)
Sets the goalkeeper.
Definition lineup.cpp:25
SetPieceDesignations designations
Definition lineup.h:289
const Strategy & getStrategy() const
Gets the strategy for this lineup.
Definition lineup.cpp:298
bool swapPlayers(PlayerID benchPlayerID, PlayerID pitchPlayerID)
Swaps a bench player with an outfield player.
Definition lineup.cpp:136
void setStrategy(const Strategy &strat)
Sets the strategy for this lineup.
Definition lineup.cpp:296
std::vector< const Player * > starters() const
Goalkeeper and outfield players of the XI (no null entries).
Definition lineup.cpp:426
void setStandIns(std::vector< StandIn > values)
Replaces the stand-ins (persistence, matchday fixes).
Definition lineup.h:230
static PlayerRole roleAt(Vector2F position)
The position a slot at position asks for: x from the own goal (defence, holding midfield,...
Definition lineup.cpp:106
static std::vector< const Player * > chooseBench(std::span< const Player *const > candidates)
A matchday bench of at most MAX_SUBSTITUTES from candidates (best first): available players before in...
Definition lineup.cpp:191
const Player * getGoalkeeper() const
Gets the goalkeeper.
Definition lineup.cpp:36
const std::vector< PositionedPlayer > & getOutfieldPlayers() const
Gets all positioned outfield players.
Definition lineup.cpp:131
const std::vector< StandIn > & getStandIns() const
Stand-ins currently filling a regular's place in the XI.
Definition lineup.h:227
void setDesignated(SetPieceDuty duty, PlayerID playerID)
Designates a player (0 = automatic) for a duty.
Definition lineup.cpp:403
Strategy strategy
Definition lineup.h:288
bool bringIn(const Player *player, PlayerID replaced)
Puts player, who is not in the matchday squad, in place of the starter or substitute replaced,...
Definition lineup.cpp:255
void generateStartingXI(const class GameData &gamedata, const std::vector< PlayerID > &allPlayerIDs, const StatsConfig &stats_config)
Generates a starting XI automatically.
Definition lineup.cpp:496
const Player * effectiveTaker(SetPieceDuty duty) const
Who performs a dead-ball duty at kick-off: the designated player when he starts, otherwise the best s...
Definition lineup.cpp:445
void setReserves(const std::vector< const Player * > &subs)
Sets the substitutes. Starters and duplicates are skipped; more than MAX_SUBSTITUTES are cut down wit...
Definition lineup.cpp:169
void addOutfieldPlayer(const Player *player, Vector2F position)
Adds an outfield player to the pitch at the specified coordinate.
Definition lineup.cpp:39
std::vector< StandIn > stand_ins
Definition lineup.h:290
void removeOutfieldPlayer(PlayerID playerID)
Removes an outfield player from the pitch.
Definition lineup.cpp:72
bool moveOutfieldPlayer(PlayerID playerID, Vector2F newPosition)
Updates the position of an existing outfield player.
Definition lineup.cpp:58
std::string toString() const
Converts the lineup to a string representation for debugging.
Definition lineup.cpp:473
static constexpr size_t MAX_SUBSTITUTES
Substitutes named for a match (the top-league norm).
Definition lineup.h:157
const std::vector< const Player * > & getReserves() const
Gets the reserve players.
Definition lineup.cpp:290
std::vector< const Player * > reserves
Definition lineup.h:287
Persistent career identity, attributes, traits and day-to-day state.
Definition player.h:104
Represents the tactical setup of a team for a match.
Definition strategy.h:61
std::array< PlayerID, SET_PIECE_DUTY_COUNT > SetPieceDesignations
Player designated for each duty; 0 = chosen automatically.
Definition lineup.h:42
SetPieceDuty
Leadership and dead-ball duties the manager can hand out (values are persisted in the lineup).
Definition lineup.h:27
constexpr size_t SET_PIECE_DUTY_COUNT
Definition lineup.h:38
Attribute-based suitability of players for set-piece duties.
Definition lineup.h:52
float score(SetPieceDuty duty, const Player &player)
Definition lineup.cpp:341
bool isLeadership(SetPieceDuty duty)
Definition lineup.cpp:335
const Player * best(SetPieceDuty duty, const std::vector< const Player * > &candidates)
Definition lineup.cpp:376
const char * dutyKey(SetPieceDuty duty)
Definition lineup.cpp:310
Vector2F position
Definition lineup.h:109
const Player * player
Definition lineup.h:108
A starter who was replaced because he could not play, and the player standing in for him until he can...
Definition lineup.h:220
PlayerID regular
Definition lineup.h:221
bool operator==(const StandIn &) const =default
PlayerID stand_in
Definition lineup.h:222
Configuration mapping roles to their focus areas and listing all possible stats.
Definition stats_config.h:42
A simple 2D float vector for pitch coordinates.
Definition types.h:84
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21
PlayerRole
Represents a specific tactical role on the pitch.
Definition types.h:63