Map is way better and components::Tile is _vastly_ improved by switching to a wchar_t on display and letting nlohmann::json auto convert it for me.
This commit is contained in:
parent
2b57552152
commit
2e79cf8781
11 changed files with 70 additions and 71 deletions
|
@ -11,7 +11,7 @@ TileMap::TileMap(size_t width, size_t height) :
|
|||
$width(width),
|
||||
$height(height),
|
||||
$tile_ids(height, matrix::Row(width, SPACE_VALUE)),
|
||||
$display(height, TileRow(width, {"", {0,0,0}, {0,0,0}}))
|
||||
$display(height, TileRow(width, {L'#', {0,0,0}, {0,0,0}}))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -38,10 +38,9 @@ void TileMap::dump(int show_x, int show_y) {
|
|||
}
|
||||
|
||||
void TileMap::set_tile(size_t x, size_t y, string tile_name) {
|
||||
std::wstring tile_id = $config.wstring(tile_name, "display");
|
||||
json tile_conf = $config[tile_name];
|
||||
auto tile = components::convert<Tile>(tile_conf);
|
||||
$tile_ids[y][x] = tile_id[0];
|
||||
$tile_ids[y][x] = tile.display;
|
||||
$display[y][x] = tile;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue