amazedoc.h

来自「一个迷宫生成算法」· C头文件 代码 · 共 87 行

H
87
字号
// AmazeDoc.h : interface of the CAmazeDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_AMAZEDOC_H__EEA2E9BF_90C8_11D4_A154_89D8A9A95671__INCLUDED_)
#define AFX_AMAZEDOC_H__EEA2E9BF_90C8_11D4_A154_89D8A9A95671__INCLUDED_

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

#define AMAZEDATA(x, y) (*(m_pData + (2*m_nHeight+2) * (x) + y))

class CAmazeDoc : public CDocument
{
protected: // create from serialization only
	CAmazeDoc();
	DECLARE_DYNCREATE(CAmazeDoc)

// Attributes
private:
	long* m_pData;
	long  m_nWidth, m_nHeight;

public:
	long* m_pDisData;
	long m_nDisNum;

// Operations
public:
	void CreateAmaze();
	void DisAmaze();
	void DeleteAmaze(){
		if(m_pData){delete [] m_pData; m_pData = NULL;	}
		if(m_pDisData){delete [] m_pDisData; m_pDisData = NULL;} 
	}

	long AmazeData(int x, int y)
	{ return *(m_pData + (2*m_nHeight+2) * (x) + y); }

	void SetWidth(int w)
	{ m_nWidth = w; }
	long GetWidth()
	{ return m_nWidth; }

	void SetHeight(int h)
	{ m_nHeight = h; }
	long GetHeight()
	{ return m_nHeight; }

	bool HaveAmaze()
	{ return m_pData != NULL; }

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAmazeDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CAmazeDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CAmazeDoc)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_AMAZEDOC_H__EEA2E9BF_90C8_11D4_A154_89D8A9A95671__INCLUDED_)

⌨️ 快捷键说明

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