44 lines
829 B
C++
44 lines
829 B
C++
#ifndef LEVEL_H
|
|
#define LEVEL_H
|
|
|
|
#include <array>
|
|
|
|
enum class CellType
|
|
{
|
|
Water = '.',
|
|
Ground = '-',
|
|
Charge = '$',
|
|
Bridge = char(177),
|
|
Hero = '@'
|
|
};
|
|
|
|
using coordinate = unsigned int;
|
|
constexpr coordinate side = 32;
|
|
|
|
using Row = std::array<CellType, side>;
|
|
using Map = std::array<Row, side>;
|
|
|
|
/// Abstraction over 2D array to quickly get access to level cells
|
|
class Level
|
|
{
|
|
private:
|
|
Map map;
|
|
|
|
public:
|
|
Level();
|
|
|
|
/// Place a bridge cell
|
|
void placeBridge(coordinate x, coordinate y);
|
|
|
|
/// Get the 2D array of level map
|
|
Map& mapArray() const;
|
|
|
|
/// Is the following cell has requested type
|
|
bool isCellOfType(coordinate x, coordinate y, CellType type) const;
|
|
|
|
/// Replace a charge cell with a ground cell
|
|
void removeCharge(coordinate x, coordinate y);
|
|
};
|
|
|
|
#endif // LEVEL_H
|