Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CGameModule Class Reference

CGameModule. More...

#include <GameModule.h>

Inheritance diagram for CGameModule:

CPlayer CGenericTask CBackgammonGM COthelloGM CStrategoGM CTicTacToeGM List of all members.

Public Member Functions

 CGameModule ()
 CGameModule.
virtual ~CGameModule ()
 ~CGameModule
uint64 GetGameTime () const
 GetGameTime.
void SetDelayStart (bool bStart=true)
 StartGame.
void StartGame ()
 StartGame.
bool IsGameOver () const
 IsGameOver.
virtual void SetTimePerMove (uint64 sec, bool moveTimerOn=false)
 SetTimePerMove.
virtual void SetGameTime (uint64 sec, bool gameTimerOn=false)
 SetGameTime.

Protected Member Functions

virtual void NewGame ()=0
 NewGame.
virtual void PlayMove (const CMove *m)=0
 PlayMove.
virtual bool CheckMove (const CMove *m)=0
 CheckMove.
virtual bool CheckForWin ()=0
 CheckForWin.
virtual void InvalidMoveProcessing (const CMove *m)=0
 InvalidMoveProcessing.
virtual void UpdateCurrentPlayerPiece ()=0
 UpdateCurrentPlayerPiece.
virtual void SetPlayerDescription ()
 SetPlayerDescription.
virtual void AddPlayer (CDescription desc)=0
 AddPlayer.
virtual void RemovePlayer (CDescription desc)=0
 RemovePlayer.
virtual void TimeElapsed (const CPlayerPiece *piece)=0
 TimeElapsed.
virtual void OnGameSpecificMessage (const CGameMessage *pMsg)
 OnGameSpecificMessage.
virtual CMoveRelayMove (CEID playerID, CMove *pMove)
 RelayMove.
void AssignPlayerPiece (CEID id, const CPiece *p)
 AssignPlayerPiece.
void PostInitMessage ()
 PostInitMessage.

Detailed Description

CGameModule.

Description: Base class for Game Modules used to speed up the creation of Game Module writing.

Limitations: NONE


Constructor & Destructor Documentation

CGameModule::CGameModule  ) 
 

CGameModule.

Description: Class constructor

Limitations: NONE

CGameModule::~CGameModule  )  [virtual]
 

~CGameModule

Description: Class deconstructor

Limitations: NONE


Member Function Documentation

virtual void CGameModule::AddPlayer CDescription  desc  )  [protected, pure virtual]
 

AddPlayer.

Description: Adds a player to the game. Should set m_bReadyToStart to true if the game is ready to start. You can assign the player a piece using the AssignPlayerPiece function.

Parameters:
desc is a description of the player.
Returns:
void
Limitations: NONE

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

void CGameModule::AssignPlayerPiece CEID  id,
const CPiece p
[protected]
 

AssignPlayerPiece.

Description: Assigns a piece to a player.

Parameters:
id is the CEID of the player to be assigned the piece.
p is the piece to assign to the player.
Returns:
void
Limitations: NONE

virtual bool CGameModule::CheckForWin  )  [protected, pure virtual]
 

CheckForWin.

Description: Checks for a win condition. If true, the function will set the m_winningMsg and m_winningMsgLength variables accordingly.

Returns:
True if the game is over and someone has won and false if the game is not yet hit a end game condition.
Limitations: NONE

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

virtual bool CGameModule::CheckMove const CMove m  )  [protected, pure virtual]
 

CheckMove.

Description: Checks a move and returns true if it is valid and false otherwise.

Parameters:
m is the move that should be checked for validity.
Returns:
True if the move is valid and false otherwise
Limitations: NONE

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

uint64 CGameModule::GetGameTime  )  const
 

GetGameTime.

Description:

Returns:
void
Limitations: NONE

virtual void CGameModule::InvalidMoveProcessing const CMove m  )  [protected, pure virtual]
 

InvalidMoveProcessing.

Description: Called when an invalid move was discovered. Set m_bGameOver to true and set the m_winningMsg & m_winningMsgLength values if you want the game to end.

Parameters:
p is the invalid move.
Returns:
void
Limitations: NONE

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

bool CGameModule::IsGameOver  )  const
 

IsGameOver.

Description: Starts a new game.

Returns:
void
Limitations: NONE

virtual void CGameModule::NewGame  )  [protected, pure virtual]
 

NewGame.

Description: Initalizes the game board and sets the m_curPiece value to the first player that should play.

Returns:
void
Limitations: NONE

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

void CGameModule::OnGameSpecificMessage const CGameMessage pMsg  )  [protected, virtual]
 

OnGameSpecificMessage.

Description: Used to process other game specific game messages

Parameters:
pMsg pointer to a game message object
Returns:
void
Limitations: NONE

Reimplemented in CStrategoGM.

virtual void CGameModule::PlayMove const CMove m  )  [protected, pure virtual]
 

PlayMove.

Description: Plays a move by updating the game board.

Parameters:
m is the move that should be made.
Returns:
void
Limitations: The move m must be a valid move.

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

void CGameModule::PostInitMessage  )  [protected]
 

PostInitMessage.

Description: Post the initial message to start the game

Returns:
void
Limitations: NONE

CMove * CGameModule::RelayMove CEID  playerID,
CMove pMove
[protected, virtual]
 

RelayMove.

Description: Used to determine which parts of a move a given player is allowed to see

Parameters:
 
Returns:
void
Limitations: NONE

Reimplemented in CStrategoGM.

virtual void CGameModule::RemovePlayer CDescription  desc  )  [protected, pure virtual]
 

RemovePlayer.

Description: Removes a player to the game. Set m_bReadyToStart to false if the game is no longer ready to start.

Parameters:
desc is a description of the player.
Returns:
void
Limitations: NONE

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

void CGameModule::SetDelayStart bool  bStart = true  ) 
 

StartGame.

Description: Starts a new game.

Returns:
void
Limitations: NONE

void CGameModule::SetGameTime uint64  sec,
bool  gameTimerOn = false
[virtual]
 

SetGameTime.

Description: Sets the number of seconds allowed per person per game.

Parameters:
 
Returns:
void
Limitations: NONE

void CGameModule::SetPlayerDescription  )  [protected, virtual]
 

SetPlayerDescription.

Description: Sets the m_PlayerInfo variable with the correct data. Override this function and set your information.

Returns:
void
Limitations: NONE

Reimplemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

void CGameModule::SetTimePerMove uint64  sec,
bool  moveTimerOn = false
[virtual]
 

SetTimePerMove.

Description: Sets the maximum number of milliseconds allowed per move.

Parameters:
 
Returns:
void
Limitations: NONE

void CGameModule::StartGame  ) 
 

StartGame.

Description: Starts a new game.

Returns:
void
Limitations: NONE

virtual void CGameModule::TimeElapsed const CPlayerPiece piece  )  [protected, pure virtual]
 

TimeElapsed.

Description: Called when either a player's move time or game time has expired

Parameters:
piece is the CPlayerPiece* of the player whose time has expired
Returns:
void
Limitations: NONE

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.

virtual void CGameModule::UpdateCurrentPlayerPiece  )  [protected, pure virtual]
 

UpdateCurrentPlayerPiece.

Description: Updates the value of the m_curPiece variable to the piece that should play now.

Returns:
void
Limitations: NONE

Implemented in CBackgammonGM, COthelloGM, CStrategoGM, and CTicTacToeGM.


The documentation for this class was generated from the following files:
Copyright (c) 2005 Matt Bruns, Pat Hammond, Kevin Markussen, Travis Service, Brain Shaver

SourceForge.net Logo