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

CPlayer Class Reference

Player. More...

#include <Player.h>

Inheritance diagram for CPlayer:

CGenericTask CGameModule CLocalPlayer CNetworkPlayer CBackgammonGM COthelloGM CStrategoGM CTicTacToeGM CAIModule CAIPlayer CAIPlayer CHumanPlayer CTournamentPlayer List of all members.

Public Member Functions

 CPlayer ()
 CPlayer.
virtual ~CPlayer (void)
 ~CPlayer
void AttachMailbox (CMailbox *)
 AttachMailbox.

Protected Member Functions

void Run ()
 Run.
void EnableBackgroundProcessing (bool bProcessing)
 EnableBackgroundProcessing.
bool PostAMessage (CMessage *pMsg)
 PostMessage.
virtual bool OnInit ()
 OnInit This handler function is called before the execution of the threads main loop.
virtual void OnMessageReceived (CMessage *pMsg)
 OnMessageRecieved This handler function is called when the player receives a message from the host.
virtual bool OnMessageSent (CMessage *pMsg)
 OnMessageSent This handler function is called whenever the player sends a message to the host.
virtual void OnForegroundProc ()
 OnForegroundProc This function is called by the framework rapidly in order to perform needed forground processing.
virtual bool OnBackgroundProc ()
 OnBackgroundProc This function is called by the framework when the player's message queue is empty.

Detailed Description

Player.

Description: The Player class provides an interface for all player objects that communicate through the primary message loop.

Limitations:


Constructor & Destructor Documentation

CPlayer::CPlayer  ) 
 

CPlayer.

Description: : This function initalizes the class's internal data members

Returns:
None
Limitations: None

CPlayer::~CPlayer void   )  [virtual]
 

~CPlayer

Description: This destructor has been included for maintenance purposes only.

Returns:
None
Limitations: None


Member Function Documentation

void CPlayer::AttachMailbox CMailbox pMbx  ) 
 

AttachMailbox.

Description: : This function attaches a mailbox to the player. The player thread cannot be started unless a mailbox is attached

Parameters:
pMailbox is the mailbox that will be attached to the player object.
Returns:
void
Limitations:

void CPlayer::EnableBackgroundProcessing bool  bProcessing  )  [protected]
 

EnableBackgroundProcessing.

Description: : This function sets the background processing mode of the player object.

Parameters:
bProcessing- The new processing state. When true, back- ground processing will be performed. When false, the processing will be skipped.
Returns:
void
Limitations: None

bool CPlayer::OnBackgroundProc  )  [protected, virtual]
 

OnBackgroundProc This function is called by the framework when the player's message queue is empty.

Return true if more processing time is needed.

Reimplemented in CHumanPlayer, and CLocalPlayer.

void CPlayer::OnForegroundProc  )  [protected, virtual]
 

OnForegroundProc This function is called by the framework rapidly in order to perform needed forground processing.

Description: : This function handler is called during each iteration of the thread's processing loop. This version, however, has just been included for maintenance purposes.

Returns:
void
Limitations: None

Reimplemented in CNetworkPlayer.

bool CPlayer::OnInit  )  [inline, protected, virtual]
 

OnInit This handler function is called before the execution of the threads main loop.

If the return of this function is false, the main loop will not be executed.

Reimplemented in CHumanPlayer, CLocalPlayer, and CNetworkPlayer.

void CPlayer::OnMessageReceived CMessage pMsg  )  [protected, virtual]
 

OnMessageRecieved This handler function is called when the player receives a message from the host.

This function should perform all custom processing of the message.

Reimplemented in CAIPlayer, CAIPlayer, CHumanPlayer, CLocalPlayer, and CNetworkPlayer.

bool CPlayer::OnMessageSent CMessage pMsg  )  [protected, virtual]
 

OnMessageSent This handler function is called whenever the player sends a message to the host.

Description: : This function handler is called when a message is to be sent to the host. This version of the function, however, has been included for maintenance.

Parameters:
pMsg - A pointer to the message that is to be sent to the host.
Returns:
void
Limitations: Never delete messages in message handlers.

Reimplemented in CLocalPlayer, and CTournamentPlayer.

bool CPlayer::PostAMessage CMessage pMsg  )  [protected]
 

PostMessage.

Description: Use this function to send messages to other players. The outgoing message is added to a "send" queue that is managed by the CMailbox class.

Parameters:
pMsg The messages that should be sent to one or more connected players
Returns:
This function returns true if the message was successfully sent. False is returned on failure.
Limitations: None

void CPlayer::Run void   )  [protected, virtual]
 

Run.

Description: This function processes the player task's message loop. This function will not return until the task is stopped.

Parameters:
None 
Returns:
void
Limitations: None

Implements CGenericTask.


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