Player12
An open source football management simulator
Loading...
Searching...
No Matches
RoleUtils Class Reference

Utilities for handling player roles and their pitch mappings. More...

#include <role_utils.h>

Static Public Member Functions

static std::string toString (PlayerRole role)
 Converts a PlayerRole enum to its string representation.
 
static const char * shortName (PlayerRole role)
 Localised short position name for display ("GK", "POR"). The codes of toString() are for persistence and parsing only.
 
static const char * longName (PlayerRole role)
 Localised full position name ("Goalkeeper", "Portiere").
 
static std::string shortNameArg (PlayerRole role)
 Inbox argument for the short name ("@ROLE_SHORT_GK"), so saved messages follow the current language.
 
static PlayerRole fromString (std::string_view role_str)
 Converts a string to a PlayerRole enum.
 
static Vector2F getBaseCoordinate (PlayerRole role)
 Gets the base pitch coordinate for a given role. Coordinates are normalized: X [0.0 (home goal) to 1.0 (away goal)], Y [0.0 (top) to 1.0 (bottom)].
 
static std::string getBroadCategory (PlayerRole role)
 Gets the broad category of the role (e.g. "Striker", "Defender"). Used for backward compatibility with older stats logic.
 

Detailed Description

Utilities for handling player roles and their pitch mappings.

Member Function Documentation

◆ fromString()

PlayerRole RoleUtils::fromString ( std::string_view  role_str)
static

Converts a string to a PlayerRole enum.

◆ getBaseCoordinate()

Vector2F RoleUtils::getBaseCoordinate ( PlayerRole  role)
static

Gets the base pitch coordinate for a given role. Coordinates are normalized: X [0.0 (home goal) to 1.0 (away goal)], Y [0.0 (top) to 1.0 (bottom)].

◆ getBroadCategory()

std::string RoleUtils::getBroadCategory ( PlayerRole  role)
static

Gets the broad category of the role (e.g. "Striker", "Defender"). Used for backward compatibility with older stats logic.

◆ longName()

const char * RoleUtils::longName ( PlayerRole  role)
static

Localised full position name ("Goalkeeper", "Portiere").

◆ shortName()

const char * RoleUtils::shortName ( PlayerRole  role)
static

Localised short position name for display ("GK", "POR"). The codes of toString() are for persistence and parsing only.

◆ shortNameArg()

std::string RoleUtils::shortNameArg ( PlayerRole  role)
static

Inbox argument for the short name ("@ROLE_SHORT_GK"), so saved messages follow the current language.

◆ toString()

std::string RoleUtils::toString ( PlayerRole  role)
static

Converts a PlayerRole enum to its string representation.


The documentation for this class was generated from the following files: