From 73f2d31c47faeea50a27422012b19150d0d248e9 Mon Sep 17 00:00:00 2001 From: grimsace Date: Tue, 28 Apr 2026 09:08:36 -0500 Subject: [PATCH] made placed stairs appear on the floor above --- src/main.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 690645e..4185fe9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1196,9 +1196,22 @@ impl DungeonApp { layout.stairs.push(stair.clone()); } } else { - // Add stairs only to the active level. - let layout = &mut self.levels[self.settings.active_level_index]; - layout.stairs.push(stair); + // Add stairs to the active level and the adjacent level above (or below for top level). + let active_idx = self.settings.active_level_index; + let layout = &mut self.levels[active_idx]; + layout.stairs.push(stair.clone()); + + // Determine which adjacent level to add the stair to. + // Stairs connect two adjacent floors, so we add them to the level above + // (or below if this is the top level). + if active_idx + 1 < self.levels.len() { + let above_layout = &mut self.levels[active_idx + 1]; + above_layout.stairs.push(stair); + } else if active_idx > 0 { + // Top level: connect to the level below + let below_layout = &mut self.levels[active_idx - 1]; + below_layout.stairs.push(stair); + } } }