PlayerFactory Class Reference

#include <playerfactory.h>

Collaboration diagram for PlayerFactory:

Collaboration graph
[legend]

List of all members.


Detailed Description

This creates any player known to the card game, and tracks them.

Author:
John Schneiderman

Public Member Functions

void clear ()
bool createPlayer (const QString &playersName, const QString &game)
 PlayerFactory ()
vector< QString > playerNames () const
vector< ComputerPlayer * > & players ()
const vector< ComputerPlayer * > & players () const
 ~PlayerFactory ()

Protected Member Functions

bool setupAIBase (const QString &playersName)
bool setupGamePlayer (const QString &game)

Constructor & Destructor Documentation

PlayerFactory::PlayerFactory (  ) 

Default constructor.

PlayerFactory::~PlayerFactory (  ) 

Default destructor.

Note:
we don't need to free our m_ais because the freeing of m_players in GameBase takes care of it.


Member Function Documentation

void PlayerFactory::clear (  ) 

Clears and frees the list of computer players.

bool PlayerFactory::createPlayer ( const QString &  playersName,
const QString &  game 
)

Creates a computer player.

Parameters:
playersName is the name of the computer player we want to create.
Note:
The name of the player must be an AI player that already exists!
Parameters:
game is the name of the game the player will be playing.
Returns:
true if the computer player was created, false if not.

vector< QString > PlayerFactory::playerNames (  )  const

Lists the names of all the players known to the factory.

Note:
the names are based on the player sentinels.
Returns:
an array filled with the names of the players.

vector< ComputerPlayer * > & PlayerFactory::players (  ) 

An accessor to the current players.

Returns:
the current player listings.

const vector< ComputerPlayer * > & PlayerFactory::players (  )  const

An accessor to the current players.

Returns:
the current player listings.

bool PlayerFactory::setupAIBase ( const QString &  playersName  )  [protected]

This sets up the AI for the computer player.

Parameters:
playersName is the name of the player we want to create based on our AI listings.
Returns:
true if the AI component was successfully created, false elsewise.

bool PlayerFactory::setupGamePlayer ( const QString &  game  )  [protected]

This sets up the computer player.

Parameters:
game is the name of the game we want the computer player to play.
Returns:
true if the computer player was successfully create, false elsewise.


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

Generated on Tue Aug 12 23:24:02 2008 for KardsGT by  doxygen 1.5.5