www.pudn.com > goodchessGame.zip > Player.h
#ifndef __PLAYER_H__
#define __PLAYER_H__
#include "Card.h"
class CFiveInOneDoc;
//CPlayer is the base class for the players of the game
class CPlayer // : public CObject
{
protected:
int m_PlayerID; //indicates the player ID
CRect m_BoundingRect; //the total rectangle of the cards owned by the player
int m_OverlappingDistance; //indicates how much overlapping is between two cards
public:
CPlayer();
virtual ~CPlayer();
CString m_strPlayerName; //indicates the names of the player
CArray m_CardArray; //this array contains the cards owned by a particular player
CRect GetBoundingRect(); //returns the total rectangle of the cards owned by the player
int GetPlayerID(); //returns the player ID of the player
void SetBoundingRect(CRect Rect); //sets the bounding rectangle
void SetPlayerID(int id); //sets the player ID
void RepositioningOneAtTime(CWnd *pParentWnd, int &X, int &Y, BOOL XConstant, BOOL FrontView); //This function positions the card in the view window
//pParentWnd is the CView window, the X and Y are the
//the coordinates the upper-left window the the card contained
//in the m_CardArray. XConstant indicates whether the cards are to be
//positioned top to down or left to right. FrontView indicates
//to show the front face of the card or the back face
void RepositioningEntire(CWnd *pParentWnd, int X, int Y, BOOL XConstant, BOOL FrontView, BOOL bVisible = TRUE); //similar to the above function but positions the entire card array (m_CardArray)
void FindAndDelete(int BmpIndex); //finds the card whose bitmap index matches with BmpIndex and removes the card from the array (m_CardArray)
void FindAndDelete(CCard &Card); //finds the card which is the same as Card and removes the card from the array (m_CardArray)
int FindCardIndex(int nBitmapIndex);
void FindAndSetSelectionFalse(CView *pView, CCard&);
void CleanUp();
};
//This CComputerPlayer class is for the players represented by the computer itself. No human interaction is necessary for these players
//If required more members will be added to CComputerPlayer
class CComputerPlayer : virtual public CPlayer
{
protected:
CString m_strBaseTableName; //Name of the database
public:
CComputerPlayer();
virtual ~CComputerPlayer();
void CreateBaseTable(); //creates table in the database.
};
//This is the class representing the human player i.e. either the host or the client
class CHumanPlayer : virtual public CPlayer
{
public:
CHumanPlayer();
virtual ~CHumanPlayer();
};
#endif