cirno-puzzle/level.cpp

38 lines
737 B
C++
Raw Normal View History

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