📄 cell.h
字号:
#pragma once
namespace _base
{
class Map;
class Cell
{
public:
//The types of cells
enum eCellType
{
CT_None = 0x000,
CT_Wumpus = 0x001,
CT_Trap = 0x002,
CT_Gold = 0x004,
CT_Stench = 0x008,
CT_Breeze = 0x010,
CT_Gleam = 0x020,
CT_Up = 0x040,
CT_Down = 0x080,
CT_Left = 0x100,
CT_Right = 0x200,
CT_HasCame = 0x400,
};
public:
//Constructor, every cell must belong to one map
Cell(Map * const map);
//Destructor
~Cell(void);
//Copy constructor, never call it
Cell(const Cell &from);
public:
//Operator "="
Cell operator = (const Cell & right);
public:
//Draw this cell, transfer the rendering information of this cell to OpenGL server
unsigned int GetDrawInfo(void) const;
//Print this cell in console
#ifdef CONSOLE
void Print(void) const;
#endif
//Get the X-coordinate of this cell
unsigned int GetX(void) const;
//Get the Y-coordinate of this cell
unsigned int GetY(void) const;
//Warning!! Set the cell type, called by super user!!
void _su_SetType(unsigned int cell_type);
//Warning!! Add one cell type, called by super user!!
void _su_AddType(unsigned int cell_type);
//Warning!! Delete one type, called by super user!!
void _su_DeleteType(unsigned int cell_type);
//Warning!! Set mHasCame, called by super user!!
void _su_SetHasCame(bool has_came);
//Get the type of the cell
unsigned int GetType(void) const;
bool IsHasCame(void) const;
public:
//intersection graph pointers
Cell * CellUp(void) const;
Cell * CellDown(void) const;
Cell * CellLeft(void) const;
Cell * CellRight(void) const;
const Cell * CellUp_const(void) const;
const Cell * CellDown_const(void) const;
const Cell * CellLeft_const(void) const;
const Cell * CellRight_const(void) const;
void _su_SetCellUp(Cell *pcell);
void _su_SetCellDown(Cell *pcell);
void _su_SetCellLeft(Cell *pcell);
void _su_SetCellRight(Cell *pcell);
//Cell informations
bool IsWumpusAround(void) const;
bool IsTrapAround(void) const;
bool IsGoldAround(void) const;
bool IsNear(unsigned type) const;
////For Debug use!!!
void _su_SetX(unsigned int x);
void _su_SetY(unsigned int y);
private:
//Get the type of the cell
unsigned int mCellType;
//The pointers to adjacent cells
Cell *m_pCellUp;
Cell *m_pCellDown;
Cell *m_pCellLeft;
Cell *m_pCellRight;
//The pointer of the map it belongs to, be aware of deleting the space!
Map * const m_pMap;
unsigned int mPositionX;
unsigned int mPositionY;
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -