stmm-games-doc  0.32.0
Classes | Public Member Functions | List of all members
stmg::AppPreferences Class Referenceabstract
Inheritance diagram for stmg::AppPreferences:
Inheritance graph
[legend]

Classes

class  PrefPlayer
 
class  PrefTeam
 

Public Member Functions

virtual ~AppPreferences () noexcept=default
 
virtual const shared_ptr< AppConfig > & getAppConfig () const noexcept=0
 The application config. More...
 
virtual int32_t getTotTeams () const noexcept=0
 The total number of teams. More...
 
virtual const shared_ptr< PrefTeamgetTeam (int32_t nTeam) const noexcept=0
 Get team by number. More...
 
virtual const shared_ptr< PrefTeamgetTeam (const std::string &sTeamName) const noexcept=0
 Get team by name. More...
 
virtual std::vector< std::string > getTeamNames () const noexcept=0
 The number of teams. More...
 
virtual int32_t getTotPlayers () const noexcept=0
 The number of players. More...
 
virtual const shared_ptr< PrefPlayergetPlayer (int32_t nPlayer) const noexcept=0
 Get player by number. More...
 
virtual const shared_ptr< PrefPlayergetPlayer (const std::string &sPlayerName) const noexcept=0
 Get player by name. More...
 
virtual void getTeammate (int32_t nPlayer, int32_t &nTeam, int32_t &nMate) const noexcept=0
 Get team an mate number from player number. More...
 
virtual int32_t getTotHumanPlayers () const noexcept=0
 The number of human players. More...
 
virtual int32_t getTotAIPlayers () const noexcept=0
 The number of AI players. More...
 
virtual int32_t getTotHumanTeams () const noexcept=0
 The number of human teams. More...
 
virtual int32_t getTotAITeams () const noexcept=0
 The number of AI teams. More...
 
virtual Variant getOptionValue (const std::string &sName) const noexcept=0
 Returns value of a game option. More...
 
virtual bool getPlayerKeyActionFromCapabilityKey (int32_t nCapabilityId, stmi::HARDWARE_KEY eKey, shared_ptr< PrefPlayer > &refPlayer, int32_t &nKeyActionId) const noexcept=0
 Given a key generated by a capability, return the player's key action. More...
 
virtual bool getPlayerKeyActionFromCapabilityKey (int32_t nCapabilityId, stmi::HARDWARE_KEY eKey, int32_t &nTeam, int32_t &nMate, int32_t &nKeyActionId) const noexcept=0
 Given a key generated by a capability, return the player's key action. More...
 
virtual bool getCapabilityPlayer (int32_t nCapabilityId, shared_ptr< PrefPlayer > &refPlayer) const noexcept=0
 The player to which a capability is assigned. More...
 
virtual bool getCapabilityPlayer (int32_t nCapabilityId, int32_t &nTeam, int32_t &nMate) const noexcept=0
 The player to which a capability is assigned. More...
 

Constructor & Destructor Documentation

◆ ~AppPreferences()

virtual stmg::AppPreferences::~AppPreferences ( )
virtualdefaultnoexcept

Member Function Documentation

◆ getAppConfig()

virtual const shared_ptr<AppConfig>& stmg::AppPreferences::getAppConfig ( ) const
pure virtualnoexcept

The application config.

Returns
The app config. Is not null.

Implemented in stmg::StdPreferences.

◆ getCapabilityPlayer() [1/2]

virtual bool stmg::AppPreferences::getCapabilityPlayer ( int32_t  nCapabilityId,
shared_ptr< PrefPlayer > &  refPlayer 
) const
pure virtualnoexcept

The player to which a capability is assigned.

Parameters
nCapabilityIdThe id of the capability.
refPlayerThe player the capability is assigned to or unchanged.
Returns
Whether the capability is assigned to a player.

Implemented in stmg::StdPreferences.

◆ getCapabilityPlayer() [2/2]

virtual bool stmg::AppPreferences::getCapabilityPlayer ( int32_t  nCapabilityId,
int32_t &  nTeam,
int32_t &  nMate 
) const
pure virtualnoexcept

The player to which a capability is assigned.

Parameters
nCapabilityIdThe id of the capability.
nTeamThe team of the player the capability is assigned to or unchanged.
nMateThe mate of the player the capability is assigned to or unchanged.
Returns
Whether the capability is assigned to a player.

Implemented in stmg::StdPreferences.

◆ getOptionValue()

virtual Variant stmg::AppPreferences::getOptionValue ( const std::string &  sName) const
pure virtualnoexcept

Returns value of a game option.

Parameters
sNameThe option name.
Returns
The value. Null if option name not defined.

Implemented in stmg::StdPreferences.

◆ getPlayer() [1/2]

virtual const shared_ptr<PrefPlayer> stmg::AppPreferences::getPlayer ( int32_t  nPlayer) const
pure virtualnoexcept

Get player by number.

Parameters
nPlayerThe player number. Must be >=0 and < AppPreferences::getTotPlayers().
Returns
The player. Is not null.

Implemented in stmg::StdPreferences.

◆ getPlayer() [2/2]

virtual const shared_ptr<PrefPlayer> stmg::AppPreferences::getPlayer ( const std::string &  sPlayerName) const
pure virtualnoexcept

Get player by name.

Player names are unique.

Parameters
sPlayerNameThe name of the player. Cannot be empty.
Returns
The player or null if not found.

Implemented in stmg::StdPreferences.

◆ getPlayerKeyActionFromCapabilityKey() [1/2]

virtual bool stmg::AppPreferences::getPlayerKeyActionFromCapabilityKey ( int32_t  nCapabilityId,
stmi::HARDWARE_KEY  eKey,
shared_ptr< PrefPlayer > &  refPlayer,
int32_t &  nKeyActionId 
) const
pure virtualnoexcept

Given a key generated by a capability, return the player's key action.

Parameters
nCapabilityIdThe id of the capability.
eKeyThe key. Cannot be stmi::HK_NULL.
refPlayerThe player associated with the key. Unchanged if not found.
nKeyActionIdThe key action associated with the key. Unchanged if not found.
Returns
Whether a key action is associated with the capability key.

Implemented in stmg::StdPreferences.

◆ getPlayerKeyActionFromCapabilityKey() [2/2]

virtual bool stmg::AppPreferences::getPlayerKeyActionFromCapabilityKey ( int32_t  nCapabilityId,
stmi::HARDWARE_KEY  eKey,
int32_t &  nTeam,
int32_t &  nMate,
int32_t &  nKeyActionId 
) const
pure virtualnoexcept

Given a key generated by a capability, return the player's key action.

Parameters
nCapabilityIdThe id of the capability.
eKeyThe key. Cannot be stmi::HK_NULL.
nTeamThe player's team associated with the key, unchanged if not found.
nMateThe player's mate associated with the key, unchanged if not found.
nKeyActionIdThe key action associated with the key. Unchanged if not found.
Returns
Whether a key action is associated with the capability key.

Implemented in stmg::StdPreferences.

◆ getTeam() [1/2]

virtual const shared_ptr<PrefTeam> stmg::AppPreferences::getTeam ( int32_t  nTeam) const
pure virtualnoexcept

Get team by number.

Parameters
nTeamThe team number. Must be >=0 and < AppPreferences::getTotTeams().
Returns
The team. Is not null.

Implemented in stmg::StdPreferences.

◆ getTeam() [2/2]

virtual const shared_ptr<PrefTeam> stmg::AppPreferences::getTeam ( const std::string &  sTeamName) const
pure virtualnoexcept

Get team by name.

Team names are unique.

Parameters
sTeamNameThe name of the team. Cannot be empty.
Returns
The team or null if not found.

Implemented in stmg::StdPreferences.

◆ getTeammate()

virtual void stmg::AppPreferences::getTeammate ( int32_t  nPlayer,
int32_t &  nTeam,
int32_t &  nMate 
) const
pure virtualnoexcept

Get team an mate number from player number.

Parameters
nPlayerThe player number. Must be valid.
nTeam(output) The team of the player.
nMate(output) The mate number within the team of the player.

Implemented in stmg::StdPreferences.

◆ getTeamNames()

virtual std::vector<std::string> stmg::AppPreferences::getTeamNames ( ) const
pure virtualnoexcept

The number of teams.

Returns
Total number of teams. Is always >= 1.

Implemented in stmg::StdPreferences.

◆ getTotAIPlayers()

virtual int32_t stmg::AppPreferences::getTotAIPlayers ( ) const
pure virtualnoexcept

The number of AI players.

Returns
Number of non human players.

Implemented in stmg::StdPreferences.

◆ getTotAITeams()

virtual int32_t stmg::AppPreferences::getTotAITeams ( ) const
pure virtualnoexcept

The number of AI teams.

Returns
Number of non human teams.

Implemented in stmg::StdPreferences.

◆ getTotHumanPlayers()

virtual int32_t stmg::AppPreferences::getTotHumanPlayers ( ) const
pure virtualnoexcept

The number of human players.

Returns
Number of non AI players.

Implemented in stmg::StdPreferences.

◆ getTotHumanTeams()

virtual int32_t stmg::AppPreferences::getTotHumanTeams ( ) const
pure virtualnoexcept

The number of human teams.

Returns
Number of non AI teams.

Implemented in stmg::StdPreferences.

◆ getTotPlayers()

virtual int32_t stmg::AppPreferences::getTotPlayers ( ) const
pure virtualnoexcept

The number of players.

Returns
Total number of players. Is always >= 1.

Implemented in stmg::StdPreferences.

◆ getTotTeams()

virtual int32_t stmg::AppPreferences::getTotTeams ( ) const
pure virtualnoexcept

The total number of teams.

Returns
The number of teams. Is always >= 1.

Implemented in stmg::StdPreferences.