Skip to content

Commit

Permalink
Add map default_tile attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisD3D committed Mar 14, 2024
1 parent 709f038 commit d0e81a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ Map::Map(const QFileInfo &file) {

// Get map tiles
tiles = new TileType[width * height];
if (root.hasAttribute("default_tile")) {
std::fill_n(tiles, width * height, types[root.attribute("default_tile")]);
} else {
std::fill_n(tiles, width * height, types["ground"]);
}
const QDomNodeList map_tiles = root.elementsByTagName("tile");
for (int i = 0; i < map_tiles.size(); i++) {
QDomElement tile = map_tiles.at(i).toElement();
Expand Down

0 comments on commit d0e81a3

Please sign in to comment.