summaryrefslogtreecommitdiff
path: root/dungeon/src/pos.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dungeon/src/pos.rs')
-rw-r--r--dungeon/src/pos.rs5
1 files changed, 2 insertions, 3 deletions
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