Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Player Class Reference

#include <players.h>

Inheritance diagram for Player:

Computer Detective Human Spy ComputerDetective ComputerSpy ComputerDetective HumanDetective HumanDetective HumanSpy ComputerSpy HumanSpy List of all members.

Public Methods

 Player (char *name, int color)
 Player (char *name, int color, PosType pos)
virtual ~Player (void)
PosType Position (void)
PosType GetPosition (void)
virtual bool IsSpy (void)
char * GetName (void)
int GetColor (void)
MoveList & GetHistory (void)
virtual int NumTokens (TokenType)
virtual Move TakeTurn (void)

Protected Methods

virtual Move ChooseMove (void)
 Player (void)

Protected Attributes

PosType Pos
MoveList History

Private Attributes

char Name [NameSize]
int Color

Constructor & Destructor Documentation

Player::Player (  void    )  [inline, protected]
 

Definition at line 35 of file players.h.

00035 { }

Player::Player (  char *    name,
int    color
) 
 

Definition at line 23 of file players.c.

References Color, Name, NameSize, and Pos.

00024   {
00025    strncpy (Name, name, NameSize);
00026    Color = color;
00027    Pos = theRules.RandomPos ();
00028   }

Player::Player (  char *    name,
int    color,
PosType    pos
) 
 

Definition at line 30 of file players.c.

References Color, Name, NameSize, Pos, and PosType.

00031   {
00032    strncpy (Name, name, NameSize);
00033    Color = color;
00034    Pos = pos;
00035   }

virtual Player::~Player (  void    )  [inline, virtual]
 

Definition at line 40 of file players.h.

00040 { }


Member Function Documentation

virtual Move Player::ChooseMove (  void    )  [inline, protected, virtual]
 

Reimplemented in Human, ComputerDetective, and ComputerSpy.

Definition at line 34 of file players.h.

References NullMove.

Referenced by Spy::TakeTurn(), and Detective::TakeTurn().

00034 { return NullMove; }

int Player::GetColor (  void    )  [inline]
 

Definition at line 46 of file players.h.

References Color.

Referenced by UserInterface::EndTurn(), UserInterface::FlashNodes(), UserInterface::GetPlayerMove(), and UserInterface::ShowAllPlayers().

00046 { return Color; }

MoveList& Player::GetHistory (  void    )  [inline]
 

Reimplemented in Spy.

Definition at line 47 of file players.h.

00047 { return History; }

char* Player::GetName (  void    )  [inline]
 

Definition at line 45 of file players.h.

References Name.

Referenced by UserInterface::AnnounceWin(), UserInterface::NoLegalMoves(), UserInterface::RevealSpy(), and PlayerWindow::Update().

00045 { return Name; }

PosType Player::GetPosition (  void    )  [inline]
 

Definition at line 43 of file players.h.

References Pos, and PosType.

Referenced by Rules::GetLegalMoves(), and PlayerWindow::Update().

00043 { return Pos; }

bool Player::IsSpy (  void    )  [virtual]
 

Reimplemented in Detective, and Spy.

Definition at line 20 of file players.c.

References False.

Referenced by UserInterface::AnnounceWin(), and UserInterface::GetPlayerMove().

00020 { return False; }

virtual int Player::NumTokens (  TokenType    )  [inline, virtual]
 

Reimplemented in Detective, and Spy.

Definition at line 49 of file players.h.

References TokenType.

Referenced by Rules::GetLegalMoves(), and PlayerWindow::Update().

00049 { return 0; }

PosType Player::Position (  void    )  [inline]
 

Definition at line 42 of file players.h.

References Pos, and PosType.

Referenced by UserInterface::BeginTurn(), UserInterface::EndTurn(), UserInterface::FlashNodes(), UserInterface::GetPlayerMove(), and UserInterface::ShowAllPlayers().

00042 { return Pos; }

virtual Move Player::TakeTurn (  void    )  [inline, virtual]
 

Reimplemented in Detective, and Spy.

Definition at line 50 of file players.h.

References NullMove.

00050 { return NullMove; }


Member Data Documentation

int Player::Color [private]
 

Definition at line 29 of file players.h.

Referenced by GetColor(), and Player().

MoveList Player::History [protected]
 

Definition at line 33 of file players.h.

Referenced by Spy::GetHistory(), and Spy::TakeTurn().

char Player::Name[NameSize] [private]
 

Definition at line 28 of file players.h.

Referenced by GetName(), and Player().

PosType Player::Pos [protected]
 

Definition at line 32 of file players.h.

Referenced by GetPosition(), Player(), Position(), Spy::TakeTurn(), and Detective::TakeTurn().


The documentation for this class was generated from the following files:
Generated on Sun Jul 6 23:07:17 2003 for Scotland Yard by doxygen1.2.15