Player Class Reference

A player of the game. More...

#include <player.h>

Collaboration diagram for Player:

Collaboration graph
[legend]
List of all members.

Signals

void signalUpdate (Player *p)
 Notify change of player data.

Public Member Functions

 Player (int id, QObject *parent=0)
 Constructor for the player.
virtual ~Player ()
 Destructor.
int id ()
 Retrive the player numner.
int getCard (int playerNumber)
 Retrive card value at given logical position.
void deleteCard (int cardPosition)
 Remove a card from the given position.
void addCard (int cardPosition, int card)
 Add a card to the given position.
void startTurn ()
 Set this player to start a turn.
void stopTurn ()
 Set this player to stop a turn.
void deal (int amount)
 Deal a number of cards to this player.
void increaseMovesWon (int amount=1)
 Increases the number of moves one for this player.
int noOfMovesWon ()
 Retrive the number of won moves for this player.
void addWonCard (int card)
 Adds a card which is one in a move to this player.
int getWonCard (int no)
 Retrieve a card won by this player.
int points ()
 Retrive the amount of points this player has.
void setPoints (int points)
 Set the points of the player.
QString name ()
 Retrive the name of the player.
void setName (QString name)
 Set the name of the player.
void addWonGame (int amount)
 Add a number of won games to the overall player statistic.
int wonGames ()
 Retrieve the number of won games.
void addGame (int amount)
 Add a number of games to the overall player statistic.
int games ()
 Retrieve the number of games.
void addScore (int amount)
 Add a score to the overall player statistic.
int score ()
 Retrieve the overall score.
AbstractInputinput ()
 Retrieve the input device of the player.
void setInput (AbstractInput *input)
 Set the input for this player.
void setDeck (Deck *deck)
 Set the deck for drawing cards.
void refresh ()
 Refresh GUI by emitting a signal.
void clear ()
 Clear the all time statistics of this player.
void setTrump (Suite trump)
 Set the trump to the player.
Suite trump ()
 Retrieve the trump.
void save (KConfigGroup &config)
 Saves the properties.
void load (KConfigGroup &config)
 Read properties.

Detailed Description

A player of the game.

Definition at line 42 of file player.h.


Constructor & Destructor Documentation

Player::Player int  id,
QObject *  parent = 0
 

Constructor for the player.

Parameters:
id The player number
parent The parent object

Definition at line 35 of file player.cpp.

References CardDeck::Club, and setName().

Here is the call graph for this function:

Player::~Player  )  [virtual]
 

Destructor.

Definition at line 54 of file player.cpp.


Member Function Documentation

void Player::addCard int  cardPosition,
int  card
 

Add a card to the given position.

Typically if the card was played back.

Parameters:
cardPosition (0..max number of cards of player)
card The actual card

Definition at line 183 of file player.cpp.

void Player::addGame int  amount  ) 
 

Add a number of games to the overall player statistic.

Parameters:
amount The amount of games

Definition at line 293 of file player.cpp.

References refresh().

Referenced by EngineTwo::evaluateGame(), and EngineTwo::startGame().

Here is the call graph for this function:

void Player::addScore int  amount  ) 
 

Add a score to the overall player statistic.

Parameters:
amount The score amount

Definition at line 308 of file player.cpp.

References refresh().

Referenced by EngineTwo::evaluateGame().

Here is the call graph for this function:

void Player::addWonCard int  card  ) 
 

Adds a card which is one in a move to this player.

Also increase this players point by the points of the card. Note, this method has to be called with both cards of a move!

Parameters:
card The card to store

Definition at line 223 of file player.cpp.

References Deck::getCardValue(), points(), and setPoints().

Referenced by EngineTwo::gameLoopFinish().

Here is the call graph for this function:

void Player::addWonGame int  amount  ) 
 

Add a number of won games to the overall player statistic.

Parameters:
amount The amount of won games

Definition at line 278 of file player.cpp.

References refresh().

Referenced by EngineTwo::evaluateGame().

Here is the call graph for this function:

void Player::clear  ) 
 

Clear the all time statistics of this player.

Definition at line 92 of file player.cpp.

References refresh().

Referenced by Mainwindow::menuClearStatistics().

Here is the call graph for this function:

void Player::deal int  amount  ) 
 

Deal a number of cards to this player.

Parameters:
amount The amount of cards

Definition at line 102 of file player.cpp.

References Deck::drawCard().

Referenced by Mainwindow::startGame().

Here is the call graph for this function:

void Player::deleteCard int  cardPosition  ) 
 

Remove a card from the given position.

Typically if the card was played.

Parameters:
cardPosition (0..max number of cards of player)

Definition at line 171 of file player.cpp.

Referenced by EngineTwo::playerInput().

int Player::games  ) 
 

Retrieve the number of games.

Returns:
The overall number of games.

Definition at line 301 of file player.cpp.

Referenced by DisplayTwo::updatePlayer().

int Player::getCard int  playerNumber  ) 
 

Retrive card value at given logical position.

Parameters:
playerNumber (0..max number of cards of player)
Returns:
Card number

Definition at line 195 of file player.cpp.

Referenced by DisplayTwo::deal(), AiInput::getBoardFromEngine(), EngineTwo::isLegalMove(), and EngineTwo::playerInput().

int Player::getWonCard int  no  ) 
 

Retrieve a card won by this player.

Parameters:
no The number of the card. Can be 0..2*noOfMovesWon().
Returns:
The card.

Definition at line 235 of file player.cpp.

int Player::id  )  [inline]
 

Retrive the player numner.

Returns:
The id.

Definition at line 60 of file player.h.

Referenced by Mainwindow::nextPlayer(), and DisplayTwo::updatePlayer().

void Player::increaseMovesWon int  amount = 1  ) 
 

Increases the number of moves one for this player.

Parameters:
amount Increase by this amount (default 1)

Definition at line 209 of file player.cpp.

Referenced by EngineTwo::gameLoopFinish().

AbstractInput * Player::input  ) 
 

Retrieve the input device of the player.

Returns:
The input device.

Definition at line 127 of file player.cpp.

Referenced by setInput(), and DisplayTwo::updatePlayer().

void Player::load KConfigGroup &  config  ) 
 

Read properties.

Parameters:
config The config group object.

Definition at line 71 of file player.cpp.

References refresh().

Referenced by ConfigTwo::load().

Here is the call graph for this function:

QString Player::name  ) 
 

Retrive the name of the player.

Returns:
The player's name.

Definition at line 263 of file player.cpp.

Referenced by EngineTwo::evaluateGame(), Mainwindow::nextPlayer(), and DisplayTwo::updatePlayer().

int Player::noOfMovesWon  ) 
 

Retrive the number of won moves for this player.

Returns:
The amount of won moves for this player.

Definition at line 216 of file player.cpp.

Referenced by EngineTwo::gameLoopFinish().

int Player::points  ) 
 

Retrive the amount of points this player has.

Returns:
The amount of points (0-120).

Definition at line 248 of file player.cpp.

Referenced by addWonCard(), EngineTwo::evaluateGame(), EngineTwo::gameLoopFinish(), and DisplayTwo::updatePlayer().

void Player::refresh  ) 
 

Refresh GUI by emitting a signal.

Definition at line 337 of file player.cpp.

References signalUpdate().

Referenced by addGame(), addScore(), addWonGame(), clear(), load(), setInput(), setName(), setPoints(), and setTrump().

void Player::save KConfigGroup &  config  ) 
 

Saves the properties.

Parameters:
config The config group object.

Definition at line 61 of file player.cpp.

Referenced by ConfigTwo::save().

int Player::score  ) 
 

Retrieve the overall score.

Returns:
The score.

Definition at line 315 of file player.cpp.

Referenced by DisplayTwo::updatePlayer().

void Player::setDeck Deck deck  ) 
 

Set the deck for drawing cards.

Parameters:
deck The deck

Definition at line 85 of file player.cpp.

Referenced by Mainwindow::startGame().

void Player::setInput AbstractInput input  ) 
 

Set the input for this player.

Parameters:
input The input device.

Definition at line 134 of file player.cpp.

References input(), AbstractInput::inputAllowed(), refresh(), AbstractInput::setId(), and AbstractInput::setInputAllowed().

Referenced by Mainwindow::menuNewLSkatGame(), and Mainwindow::setInputType().

Here is the call graph for this function:

void Player::setName QString  name  ) 
 

Set the name of the player.

Emits the signal signalUpdateName(int)

Parameters:
name The new name.

Definition at line 270 of file player.cpp.

References refresh().

Referenced by Player().

Here is the call graph for this function:

void Player::setPoints int  points  ) 
 

Set the points of the player.

Emits the signal signalUpdatePoints(int)

Parameters:
points The points.

Definition at line 255 of file player.cpp.

References refresh().

Referenced by addWonCard().

Here is the call graph for this function:

void Player::setTrump Suite  trump  ) 
 

Set the trump to the player.

Parameters:
trump The trump suite

Definition at line 322 of file player.cpp.

References refresh().

Referenced by Mainwindow::startGame().

Here is the call graph for this function:

void Player::signalUpdate Player p  )  [signal]
 

Notify change of player data.

Parameters:
p This player

Referenced by refresh().

void Player::startTurn  ) 
 

Set this player to start a turn.

Definition at line 157 of file player.cpp.

References AbstractInput::setInputAllowed().

Here is the call graph for this function:

void Player::stopTurn  ) 
 

Set this player to stop a turn.

Definition at line 164 of file player.cpp.

References AbstractInput::setInputAllowed().

Referenced by EngineTwo::playerInput().

Here is the call graph for this function:

Suite Player::trump  ) 
 

Retrieve the trump.

Returns:
The trump suite.

Definition at line 330 of file player.cpp.

Referenced by DisplayTwo::updatePlayer().

int Player::wonGames  ) 
 

Retrieve the number of won games.

Returns:
The number of games won.

Definition at line 286 of file player.cpp.

Referenced by DisplayTwo::updatePlayer().


The documentation for this class was generated from the following files:
Generated on Tue May 1 09:34:40 2007 for LSkat by  doxygen 1.4.6