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.

51 lines
1.0 KiB
C++

#include "level.h"
Level::Level()
{
// Fill the level with water
for (Row &row : map)
{
for (CellType &cell : row)
cell = CellType::Water;
}
// Temporary mock
map[1][1] = CellType::Ground;
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[3][3] = CellType::Ground;
map[6][3] = CellType::Ground;
map[6][4] = CellType::Ground;
map[6][5] = CellType::Ground;
map[6][6] = CellType::Ground;
map[7][6] = CellType::Ground;
map[9][6] = CellType::Ground;
map[2][3] = CellType::Charge;
}
void Level::placeBridge(coordinate x, coordinate y)
{
map[x][y] = CellType::Bridge;
}
bool Level::isCellOfType(coordinate x, coordinate y, CellType type) const
{
return (map[x][y] == type);
}
void Level::removeCharge(coordinate x, coordinate y)
{
map[x][y] = CellType::Ground;
}
Map& Level::mapArray()
{
return map;
}