You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
912 B
C++

#ifndef LEVEL_H
#define LEVEL_H
#include <array>
enum class CellType
{
Water = '.',
Ground = '-',
Charge = '$',
Bridge = char(177),
Hero = '@',
Exit = '#',
Wall = 'X'
};
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();
/// Returns type of requested map cell
CellType cellOfType(coordinate x, coordinate y) const;
/// Replace a charge cell with a ground cell
void removeCharge(coordinate x, coordinate y);
/// Set new map for the level
void setMap(const Map& new_map);
};
#endif // LEVEL_H