gave up and limited recursion depth

This commit is contained in:
2026-08-15 14:00:23 -05:00
parent 56f0a1b385
commit 1fa47f6418
6 changed files with 110 additions and 14 deletions
+16 -10
View File
@@ -112,16 +112,16 @@ impl Board {
///
/// With a single grid the draw order is a fixed precedence (no layer walk):
///
/// 1. the player (drawn on top; not part of the grid yet);
/// 2. an object at the cell — a solid object always, otherwise the first
/// non-transparent non-solid object (`tile != 0`, so invisible objects exist);
/// 3. the grid cell `(glyph, arch)` — a solid always draws, a non-solid only when
/// visible (`tile != 0`);
/// 4. a portal at the cell (portals sit on a transparent grid cell);
/// 5. a [`decoration`](Board::decorations) at the cell (reached only because the
/// grid cell was empty);
/// 6. the [`floor`](Board::floor) glyph, if any;
/// 7. the canonical black `Empty` glyph.
/// 1. a sensor `Above` the grid whose glyph is visible (drawn on top of the
/// player too);
/// 2. the grid cell's tile — the player or an object — when its glyph is
/// visible (`tile != 0`, so invisible objects exist);
/// 3. a sensor `Below` the grid whose glyph is visible (only reachable
/// because the grid cell drew nothing);
/// 4. a portal at the cell (portals sit on a transparent grid cell), when
/// its glyph is visible;
/// 5. the [`floor`](Board::floor) glyph, if any;
/// 6. the canonical black `Empty` glyph.
///
/// Panics if out of bounds.
pub fn glyph_at<P: Into<Point>>(&self, p: P) -> Glyph {
@@ -145,6 +145,12 @@ impl Board {
return below.scripting.glyph;
}
// A portal at the cell, if its glyph is visible (a `tile = 0` portal is
// deliberately invisible, so the floor shows through instead).
if let Some(portal) = self.portal_at(p) && portal.glyph.is_visible() {
return portal.glyph;
}
// Otherwise the floor, or the canonical black empty cell.
self.floor.glyph_at(p, self.width).unwrap_or_else(Glyph::transparent)
}