//
// Created by m on 12/14/21.
//

#include "tilemap.hpp"
#include "../engine/utility/point.hpp"

void TileMap::draw_floor(int x, int y) {
    grid.insert(x, y, floor_tile);
}

void TileMap::draw_wall(int x, int y) {
    grid.insert(x, y, wall_tile);
}

char TileMap::get_tile(int x, int y) {
    return grid.get(x, y);
}

void TileMap::fill(bool wall) {
    for(Point p : grid.get_range()) {
        if(wall) {
            draw_wall(p.x, p.y);
        }
        else {
            draw_floor(p.x, p.y);
        }
    }

}

bool TileMap::is_wall(int x, int y) {
    return get_tile(x, y) == wall_tile;
}

int TileMap::get_width() {
    return grid.get_width();
}

int TileMap::get_height() {
    return grid.get_height();
}
