From 4733ab5e17b3bc98ec6243101a2968c9ec04f635 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 16 Oct 2025 12:13:32 -0400 Subject: dungeon: make const_pos! not require name param --- dungeon/src/map.rs | 4 ++-- dungeon/src/pos.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'dungeon') diff --git a/dungeon/src/map.rs b/dungeon/src/map.rs index f5c1184..97bb36c 100644 --- a/dungeon/src/map.rs +++ b/dungeon/src/map.rs @@ -196,7 +196,7 @@ impl Floor { impl Default for Floor { /// Returns a floor with a single set of walls on the map border fn default() -> Self { - const_pos!(PLAYER_START, 1, 1); + let player_start = const_pos!(1, 1); let mut tiles = Box::new([Tile::Air; TILE_COUNT]); let seed = 0u64; @@ -208,7 +208,7 @@ impl Default for Floor { Self { tiles, - player_start: PLAYER_START, + player_start, seed, } } diff --git a/dungeon/src/pos.rs b/dungeon/src/pos.rs index a1de65e..4947ce2 100644 --- a/dungeon/src/pos.rs +++ b/dungeon/src/pos.rs @@ -17,9 +17,10 @@ macro_rules! downcast { #[macro_export] macro_rules! const_pos { - ($name:ident, $x:expr, $y:expr) => { - const $name: Pos = Pos::new_unchecked($x, $y); - }; + ($x:expr, $y:expr) => {{ + const CONST_POS: Pos = Pos::new_unchecked($x, $y); + CONST_POS + }}; } /// The `Direction` type represents a direction an entity @@ -249,7 +250,6 @@ impl Default for Pos { /// ``` /// fn default() -> Self { - const_pos!(DEFAULT, 0, 0); - DEFAULT + const_pos!(0, 0) } } -- cgit v1.2.3-freya