chessarray.h

来自「chess game wirte by Visual C++」· C头文件 代码 · 共 69 行

H
69
字号
// ChessArray.h: interface for the CChessArray class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CHESSARRAY_H__805668C6_532C_11D4_BDEB_0000E8E83B61__INCLUDED_)
#define AFX_CHESSARRAY_H__805668C6_532C_11D4_BDEB_0000E8E83B61__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

typedef struct 
{
	CPoint point;
	char string[3];
}CHESSMAN, *PCHESSMAN;

class CChessArray : public CObject  
{
	friend class CPointArray;
	DECLARE_DYNAMIC(CChessArray)
public:
	CChessArray();
	void InitArray(int iCount);
	CChessArray(CChessArray &chessArray);
	CChessArray & operator= (CChessArray &chessArray);
	virtual ~CChessArray();
private:
	PCHESSMAN m_pChessman;
	int m_iCount;
public:
	int GetCount(){return m_iCount;}
	PCHESSMAN GetPoint(){return m_pChessman;}
	CPoint GetPointOrg(int iCount);
	void SetPoint(PCHESSMAN p){m_pChessman = p;}
	void SetChessman(int icount, CHESSMAN man);
	PCHESSMAN GetChessman(int iCount);
	void SetChessmanValue(int iCount, char*p);
	void SetChessmanPoint(int iCount, CPoint point);
};

class CPointArray
{
public:
	CPoint *m_pointArray;
	CPoint *m_pointOpponent;
public:
	CPointArray();
	~CPointArray();
	void SetValue(CChessArray &chess1, CChessArray &chess2);
	
public:
	BOOL IsPointCorrect(int iCount, CPoint &point);
private:
	BOOL IsCorrectVehicle(int iCount, CPoint &point);
	BOOL IsCorrectHorse(int iCount, CPoint &point);
	BOOL IsCorrectElephant(int iCount, CPoint &point);
	BOOL IsCorrectScholar(int iCount, CPoint &point);
	BOOL IsCorrectGeneral(int iCount, CPoint &point);
	BOOL IsCorrectGun(int iCount, CPoint &point);
	BOOL IsCorrectSoldier(int iCount, CPoint &point);

	BOOL PtInRgn(int iChessman, int iCount, CPoint *pPoint, CPoint &point);
	BOOL IsInChessman(CPoint point);

};

#endif // !defined(AFX_CHESSARRAY_H__805668C6_532C_11D4_BDEB_0000E8E83B61__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?