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

CClient Class Reference

CClient. More...

#include <Client.h>

Inheritance diagram for CClient:

CGenericTask CParamable List of all members.

Public Member Functions

 CClient (CMailbox *pGUIMailbox=NULL)
 CClient.
 ~CClient ()
 ~CClient
bool IsGameOver () const
 IsGameOver.
void SetDelayGameStart (bool bStart=true)
 SetDelayGameStart.
bool StartGame ()
 StartGame.
bool SetClientMode (int32 mode)
 SetClientMode.
int32 GetClientMode () const
 GetClientMode.
bool SetClientPort (uint16 port)
 SetClientPort.
bool ConnectToRemoteClient (const int8 *pAddress, uint16 port=CAFFEINE_PORT_NUMBER)
 ConnectToRemoteClient.
bool LoadGameModule (const int8 *path)
 LoadGameModule.
bool IsGameModuleLoaded ()
 IsGameModuleLoaded.
const CDescription *const GetGameInfo ()
 GetGameInfo.
int32 LoadPlayerModule (const int8 *path, bool bSetRandNum=false, uint32 randNum=0)
 LoadPlayerModule.
bool UnloadPlayer (uint32 idx)
 UnloadPlayer.
bool UnloadModuleFromCEID (CEID ceid)
 UnloadModuleFromCEID.
const CDescription *const GetPlayerInfo (uint32 iPlayer) const
 GetPlayerInfo.
int32 GetPlayerCount (int32 iType=-1) const
 GetPlayerCount.
uint32 RunBenchmark (uint32 duration)
 RunBenchmark.
uint32 GetBenchmarkRes () const
 GetBenchmarkValue.

Protected Member Functions

void Run ()
 Run.
bool OnInit ()
 OnInit.
void ProcessNewConnections ()
 ProcessNewConnections.
void ProcessNewPlayers ()
void CheckDelinquentConnections ()
 CheckDelinquentConnections.
CPlayerRecastPlayer (CNetworkPlayer *pPlayer, int32 iNewType)
 Limitations: None
bool LoadFromLibrary (PLAYERINFO &)
 LoadFromLibrary.
void UnloadLibrary (PLAYERINFO &)
 Description: Waits until the player/game module is not running and then frees all memory used by that player/game module
void EnableBroadcastUDPAddress (bool bEnable)
 EnableBroadcastUDPAddress.
void BroadcastUDPIdentity ()
 BroadcastUDPAddress.
uint32 ResizePlayerList (int32 iAmount)
 SwitchModes.
void RefreshGUI ()
 RefreshGUI.
void SendMessageToGUI (const CMessage *)
 SendMessageToGUI.

Detailed Description

CClient.

Description: : The client class is the primary class that faciliates the functionality of the client software application.

Limitations: : None


Constructor & Destructor Documentation

CClient::CClient CMailbox pGUIMailbox = NULL  ) 
 

CClient.

Description: Class constructor

Limitations: NONE

CClient::~CClient  ) 
 

~CClient

Description:

Parameters:
kevin is a character string.
Returns:
void
Limitations:


Member Function Documentation

void CClient::BroadcastUDPIdentity  )  [protected]
 

BroadcastUDPAddress.

Description: : This function sends a broadcast UDP message telling clients of the existance of this host client or tourn server

Returns:
void
Limitations: None

void CClient::CheckDelinquentConnections  )  [protected]
 

CheckDelinquentConnections.

Description:

Returns:
void
Limitations: None

bool CClient::ConnectToRemoteClient const int8 *  pAddress,
uint16  port = CAFFEINE_PORT_NUMBER
 

ConnectToRemoteClient.

Description: Connects to another client

Parameters:
int8* - Address of the other client
Returns:
void
Limitations: None

void CClient::EnableBroadcastUDPAddress bool  bEnable  )  [protected]
 

EnableBroadcastUDPAddress.

Description: : This function enables or disables the broadcasting of CLanMessages initialized with client information. The broadcast messages are received by instances of the CAddressBook class listening on CAFFEINE_PORT_NUMBER.

Returns:
void
Limitations: None

uint32 CClient::GetBenchmarkRes  )  const
 

GetBenchmarkValue.

Description:: Returns the performance measure from the last time the benchmark was executed.

Returns:
uint32: The performance measure.
Limitations: None

int32 CClient::GetClientMode  )  const
 

GetClientMode.

Description: : Fetches the current mode of the client.

Returns:
int32: the mode of the client.
Limitations: None

const CDescription *const CClient::GetGameInfo  ) 
 

GetGameInfo.

Description: This function returns the description of the game module.

Returns:
The CDescription of the module or NULL if no game module has been loaded.
Limitations: None

int32 CClient::GetPlayerCount int32  iType = -1  )  const [inline]
 

GetPlayerCount.

Description: This function returns the number of CPlayer connections.

Returns:
int32 - The number of open connections.
Limitations: None

const CDescription *const CClient::GetPlayerInfo uint32  iPlayer  )  const
 

GetPlayerInfo.

Description: This function returns the description of the specified player. The players are referenced using their index. Call the GetPlayerCount() function to retrieve the value range of index numbers. Player indexes are zero based.

Parameters:
iPlayer,: The index of the player whose information is to be retrieved.
Returns:
The CDescription of the player or NULL if the index was invalid.
Limitations: None

bool CClient::IsGameModuleLoaded  )  [inline]
 

IsGameModuleLoaded.

Description: This function checks to see if a game module has been Loaded.

Returns:
bool: True if the module has been loaded, else false.
Limitations: None

bool CClient::IsGameOver  )  const
 

IsGameOver.

Description: Returns true if there is not a game being played currently.

Returns:
True if there is not a game being played currently, and false otherwise.
Limitations: NONE

bool CClient::LoadFromLibrary PLAYERINFO &  pi  )  [protected]
 

LoadFromLibrary.

Description: Loads a game of AI module from a DLL file

Returns:
void
Limitations: None

bool CClient::LoadGameModule const int8 *  path  ) 
 

LoadGameModule.

Description: Sets the path to the game module

Parameters:
path is the absolute path to the game module
Returns:
bool - True if the module was loaded.
Limitations: path must be a null terminated string

int32 CClient::LoadPlayerModule const int8 *  path,
bool  bSetRandNum = false,
uint32  randNum = 0
 

LoadPlayerModule.

Description: Adds a player module path to this client

Parameters:
path is an absolute path to the player module file.
Returns:
bool: true if the player module is loaded.
Limitations: path must be a null terminated string

bool CClient::OnInit  )  [protected]
 

OnInit.

Description: Initializes the two sockets used by the client and starts the dispatcher

Returns:
void
Limitations: None

void CClient::ProcessNewConnections  )  [protected]
 

ProcessNewConnections.

Description: Handles all processing of new incoming connections

Returns:
void
Limitations: None

void CClient::ProcessNewPlayers  )  [protected]
 

Returns:
void
Limitations: None

void CClient::RefreshGUI  )  [protected]
 

RefreshGUI.

Description: This function formats a message that instructs the GUI to refresh its player lists. The message is then queued for transmission.

Returns:
void
Limitations: NONE

uint32 CClient::ResizePlayerList int32  iAmount  )  [protected]
 

SwitchModes.

Description: : The current mode of the client is switched to the new provided mode. Any transitional operations that are required are performed here.

Returns:
void
Limitations: None

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

Run.

Description: The main task loop for the CClient class

Returns:
void
Limitations: None

Implements CGenericTask.

uint32 CClient::RunBenchmark uint32  duration  ) 
 

RunBenchmark.

Description: : Executes a benchmark of the operating computer. The result can be used by the framework to ensure fairness during games between players operating on differntly-equipted machines.

Parameters:
duration,: the duration to run the benchmark in milliseconds.
Returns:
void
Limitations: None

void CClient::SendMessageToGUI const CMessage pMsg  )  [protected]
 

SendMessageToGUI.

Description: Sends the message to the client GUI.

Returns:
void
Limitations: NONE

bool CClient::SetClientMode int32  iNewMode  ) 
 

SetClientMode.

Description: : Sets the current mode of the client. If the new mode is invalid, the operating mode is not changed.

Returns:
bool: true if the mode was changed, false otherwise.
Limitations: None

bool CClient::SetClientPort uint16  port  ) 
 

SetClientPort.

Description: : The current mode of the client is switched to the new provided mode. Any transitional operations that are required are performed here.

Returns:
void
Limitations: None

void CClient::SetDelayGameStart bool  bStart = true  ) 
 

SetDelayGameStart.

Description: Sets or unsets the delay start option for the game module.

Parameters:
bStart is true if the game module should delay starting the game, and false otherwise.
Returns:
void
Limitations: NONE

bool CClient::StartGame  ) 
 

StartGame.

Description: Starts a game if one isn't started already.

Returns:
void
Limitations: NONE

void CClient::UnloadLibrary PLAYERINFO &  pi  )  [protected]
 

Description: Waits until the player/game module is not running and then frees all memory used by that player/game module

Returns:
void
Limitations: The player's mailbox should be detached from the dispatcher prior to unloading.

bool CClient::UnloadModuleFromCEID CEID  ceid  ) 
 

UnloadModuleFromCEID.

Description: Will unload a player from a given ceid.

Returns:
True if the player was found, false otherwise
Limitations: NONE

bool CClient::UnloadPlayer uint32  idx  ) 
 

UnloadPlayer.

Description:

Parameters:
idx into the m_pPlayerList array storing PLAYERINFO information about LOCAL players.
Returns:
bool: true if the player was unloaded properly.
Limitations: None


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