⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 map.h

📁 巫魔问题求解
💻 H
字号:
#pragma once
#include <vector>
#include "Cell.h"

namespace _base
{
    class Cell;

    class Map
    {
    public:
        //Constructor
        Map(unsigned int x_border, unsigned int y_border);
        Map(char *filename);

        //Destructor
        ~Map(void);

        //Copy constructor
        Map(const Map & from);

    public:
        //Operator "="
        Map operator = (const Map &right);

    public:
        //Print the map into console
#ifdef CONSOLE
        void Print(void) const;
#endif

        //Get the direct indicate of cell (x,y)
        Cell & TheCell(unsigned int x, unsigned int y);
        //Get the const indicate of cell (x,y)
        const Cell & GetCell(unsigned int x, unsigned int y) const;

        //Get the base pointer of the cells
        std::vector<Cell> & _su_GetCells(void);

        //Check if the point is in the map
        bool IsInMap(unsigned int x, unsigned int y) const;

        //Get the borders of the map
        unsigned int GetXBorder(void) const;
        unsigned int GetYBorder(void) const;

        void Save(char *filename) const;
        void Reset(char *filename);

    protected:
        void Open(char *filename);

        void LinkCells(void);

        /*****************
        *Note:
        *the coordinate is set as below:
        *^
        *|
        *x
        * y->
        ******************/
        //The pointer of cells
        std::vector<Cell> mCells;

        //X border
        unsigned int mXBorder;
        //Y border
        unsigned int mYBorder;

    };
}

⌨️ 快捷键说明

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