cirno-puzzle/level.h

44 lines
829 B
C
Raw Normal View History

2020-02-19 12:50:09 -05:00
#ifndef LEVEL_H
#define LEVEL_H
#include <array>
2020-02-21 09:29:06 -05:00
enum class CellType
{
Water = '.',
Ground = '-',
Charge = '$',
2020-02-21 09:29:06 -05:00
Bridge = char(177),
Hero = '@'
};
2020-02-21 09:13:12 -05:00
using coordinate = unsigned int;
constexpr coordinate side = 32;
2020-02-19 12:50:09 -05:00
using Row = std::array<CellType, side>;
2020-02-20 13:34:41 -05:00
using Map = std::array<Row, side>;
2020-02-19 12:50:09 -05:00
/// Abstraction over 2D array to quickly get access to level cells
2020-02-19 12:50:09 -05:00
class Level
{
private:
Map map;
public:
Level();
2020-02-20 13:34:41 -05:00
/// Place a bridge cell
2020-02-21 09:13:12 -05:00
void placeBridge(coordinate x, coordinate y);
2020-02-20 13:34:41 -05:00
/// Get the 2D array of level map
Map& mapArray() const;
2020-02-21 09:13:12 -05:00
/// Is the following cell has requested type
bool isCellOfType(coordinate x, coordinate y, CellType type) const;
2020-02-20 13:34:41 -05:00
/// Replace a charge cell with a ground cell
2020-02-21 09:13:12 -05:00
void removeCharge(coordinate x, coordinate y);
2020-02-19 12:50:09 -05:00
};
#endif // LEVEL_H