cirno-puzzle/level.cpp

39 lines
646 B
C++
Raw Normal View History

2020-02-19 18:50:09 +01:00
#include "level.h"
Level::Level()
{
2020-02-20 19:34:41 +01:00
// Fill the level with water
for (Row &row : map)
{
for (char &cell : row)
cell = '.';
}
2020-02-19 18:50:09 +01:00
2020-02-20 19:34:41 +01:00
// Temporary mock
// Ground
map[1][2] = '-';
map[1][3] = '-';
map[1][4] = '-';
map[2][2] = '-';
map[3][2] = '-';
map[3][3] = '-';
// Charge
map[2][3] = '$';
}
2020-02-21 15:13:12 +01:00
void Level::placeBridge(coordinate x, coordinate y)
2020-02-20 19:34:41 +01:00
{
map[x][y] = static_cast<char>(177);
}
2020-02-21 15:13:12 +01:00
bool Level::isCellOfType(coordinate x, coordinate y, char type) const
2020-02-20 19:34:41 +01:00
{
2020-02-21 15:13:12 +01:00
return (map[x][y] == type);
2020-02-20 19:34:41 +01:00
}
2020-02-21 15:13:12 +01:00
void Level::removeCharge(coordinate x, coordinate y)
2020-02-20 19:34:41 +01:00
{
map[x][y] = '-';
2020-02-19 18:50:09 +01:00
}