stmm-games-doc  0.32.0
Public Member Functions | List of all members
stmg::StdPreferences::Team Class Reference
Inheritance diagram for stmg::StdPreferences::Team:
Inheritance graph
[legend]

Public Member Functions

 Team () noexcept
 
const std::string & getName () const noexcept override
 The team's name. More...
 
bool isAI () const noexcept override
 Whether the team is AI. More...
 
int32_t getTotMates () const noexcept override
 The number of mates in the team. More...
 
const shared_ptr< PrefPlayergetMate (int32_t nMate) const noexcept override
 Get a mate of the team. More...
 
Variant getOptionValue (const std::string &sOptionName) const noexcept override
 Returns value of a team specific option. More...
 
int32_t get () const noexcept override
 The team number within the game. More...
 
const shared_ptr< Player > & getMateFull (int32_t nMate) const noexcept
 Get a teammate. More...
 
bool setName (const std::string &sNewName) noexcept
 Set the team's name. More...
 
bool setOptionValue (const std::string &sOptionName, const Variant &oValue) noexcept
 Set the value of a team's option. More...
 
int32_t getTotAIMates () const noexcept
 Get the number of AI teammates. More...
 
bool setTotMates (int32_t nTotMates) noexcept
 Sets the number of the mates of the team. More...
 
- Public Member Functions inherited from stmg::AppPreferences::PrefTeam
virtual ~PrefTeam () noexcept=default
 

Constructor & Destructor Documentation

◆ Team()

stmg::StdPreferences::Team::Team ( )
inlinenoexcept

Member Function Documentation

◆ get()

int32_t stmg::StdPreferences::Team::get ( ) const
inlineoverridevirtualnoexcept

The team number within the game.

Returns
The team number. Is >= 0 and < AppPreferences::getTotTeams().

Implements stmg::AppPreferences::PrefTeam.

◆ getMate()

const shared_ptr<PrefPlayer> stmg::StdPreferences::Team::getMate ( int32_t  nMate) const
overridevirtualnoexcept

Get a mate of the team.

Parameters
nMateThe mate number. Must be >=0 and < getTotMates().
Returns
The player. Is not null.

Implements stmg::AppPreferences::PrefTeam.

◆ getMateFull()

const shared_ptr<Player>& stmg::StdPreferences::Team::getMateFull ( int32_t  nMate) const
noexcept

Get a teammate.

Parameters
nMateThe index. Must be >= 0 and smaller than getTotMates().
Returns
The team's player. Cannot be null.

◆ getName()

const std::string& stmg::StdPreferences::Team::getName ( ) const
inlineoverridevirtualnoexcept

The team's name.

The name is unique among all teams.

Returns
The name. Is not empty.

Implements stmg::AppPreferences::PrefTeam.

◆ getOptionValue()

Variant stmg::StdPreferences::Team::getOptionValue ( const std::string &  sOptionName) const
overridevirtualnoexcept

Returns value of a team specific option.

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

Implements stmg::AppPreferences::PrefTeam.

◆ getTotAIMates()

int32_t stmg::StdPreferences::Team::getTotAIMates ( ) const
noexcept

Get the number of AI teammates.

Returns
The number of team's non human players.

◆ getTotMates()

int32_t stmg::StdPreferences::Team::getTotMates ( ) const
inlineoverridevirtualnoexcept

The number of mates in the team.

Returns
The number of players that belong to the team.

Implements stmg::AppPreferences::PrefTeam.

◆ isAI()

bool stmg::StdPreferences::Team::isAI ( ) const
inlineoverridevirtualnoexcept

Whether the team is AI.

The team is AI if all its mates are AI.

Returns
Whether AI.

Implements stmg::AppPreferences::PrefTeam.

◆ setName()

bool stmg::StdPreferences::Team::setName ( const std::string &  sNewName)
noexcept

Set the team's name.

If another existing team already has the name the operation fails and false is returned.

Parameters
sNewNameThe new name. Cannot be empty.
Returns
Whether the name could be changed.

◆ setOptionValue()

bool stmg::StdPreferences::Team::setOptionValue ( const std::string &  sOptionName,
const Variant oValue 
)
noexcept

Set the value of a team's option.

Parameters
sOptionNameThe name of the option. Must exist and not be read only.
oValueThe new value.
Returns
Whether the operation succeeded.

◆ setTotMates()

bool stmg::StdPreferences::Team::setTotMates ( int32_t  nTotMates)
noexcept

Sets the number of the mates of the team.

Depending on the current number of mates, players are deleted or added accordingly.

Parameters
nTotMatesThe new number of mates. Must be >= 1.
Returns
Whether the target number of mates was reached.