From 9d94571468c6b8e03c066732091d762a494d3cf2 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 8 Nov 2025 19:16:57 -0500 Subject: dungeon: fix pos idx overflow --- dungeon/src/pos.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'dungeon') diff --git a/dungeon/src/pos.rs b/dungeon/src/pos.rs index ac2d6d0..f6c5eb4 100644 --- a/dungeon/src/pos.rs +++ b/dungeon/src/pos.rs @@ -194,9 +194,8 @@ impl Pos { /// ``` #[must_use] pub const fn idx(self) -> usize { - let (x, y) = self.xy(); - let idx = x + y * MAP_SIZE; - idx as usize + let (x, y) = (self.x() as usize, self.y() as usize); + x + y * MAP_SIZE_USIZE } /// Converse an index into a possible x and y position -- cgit v1.2.3-freya