Really crappy minimap now displays.

This commit is contained in:
Zed A. Shaw 2025-02-06 15:03:46 -05:00
parent e85b5d998b
commit 25ad9b51f8
5 changed files with 51 additions and 17 deletions

View file

@ -73,3 +73,21 @@ bool TileMap::INVARIANT() {
dbc::check(matrix::width($tile_ids) == $width, "$tile_ids has wrong width");
return true;
}
std::wstring TileMap::minimap(size_t x, size_t y) {
string result;
for(matrix::box it{$tile_ids, x, y, 5}; it.next();) {
const TileCell &cell = $display[it.y][it.x];
if(it.x == x && it.y == y) {
result += "@";
} else {
result += cell.display;
}
if(it.x == it.right - 1) result += "\n";
}
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> $converter;
return $converter.from_bytes(result);
}