// Loading map void Map::loadMap(const string mapFile) { // Decode map file lodepng::decode(pixels, width, height, mapFile); // Resize the map vector with the height map.resize(height); // Going over all of the cells in the map for (unsigned int y = 0; y < height; y++) { // Resizing every cell with the given width map[y].resize(width); } Point current; // Going over all of the cells to the height of the map for (unsigned int y = 0; y < height; y++) { // Going over all of the cell to the width of the map for (unsigned int x = 0; x < width; x++) { current.y = y; current.x = x; // Checking if the current cell is occupied map[y][x] = checkIfCellIsOccupied(current); } } // Print the new map printMap(); }
void Map::loadMap(const char* mapFile) { lodepng::decode(pixels, width, height, mapFile); map.resize(height); for (int i = 0; i < height; i++) { map[i].resize(width); } for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { map[i][j] = checkIfCellIsOccupied(i, j); } } printMap(); }