refactoring
This commit is contained in:
+2
-11
@@ -7,7 +7,7 @@
|
||||
|
||||
use crate::cp437::tile_to_char;
|
||||
use color::Rgba8;
|
||||
use kiln_core::game::{Board, Glyph};
|
||||
use kiln_core::Board;
|
||||
use kiln_core::log::LogLine;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Rect;
|
||||
@@ -100,16 +100,7 @@ impl Widget for BoardWidget<'_> {
|
||||
let bx = off_x + col;
|
||||
let sx = area.x + pad_x + col as u16;
|
||||
|
||||
// Resolve which glyph wins this cell: player > object > grid floor.
|
||||
let glyph = if board.player.x == bx as i32 && board.player.y == by as i32 {
|
||||
Glyph::player()
|
||||
} else if let Some(id) = board.object_ids_at(bx, by).get(0) {
|
||||
board.objects[id].glyph
|
||||
} else {
|
||||
// Static layer: the grid archetype's glyph, or the floor layer
|
||||
// for an empty cell (see `Board::display_glyph`).
|
||||
board.display_glyph(bx, by)
|
||||
};
|
||||
let glyph = board.glyph_at(bx, by);
|
||||
|
||||
// Paint the resolved glyph into the terminal cell.
|
||||
if let Some(cell) = buf.cell_mut((sx, sy)) {
|
||||
|
||||
Reference in New Issue
Block a user