summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/src/lib.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/game/src/lib.rs b/game/src/lib.rs
index b6d2fa4..8465ff3 100644
--- a/game/src/lib.rs
+++ b/game/src/lib.rs
@@ -1,7 +1,4 @@
-use dungeon::{
- Dungeon, UpdateResult, entity::PLAYER_INVENTORY_SIZE, player_input::PlayerInput,
- pos::Direction,
-};
+use dungeon::{Dungeon, UpdateResult, player_input::PlayerInput, pos::Direction};
use graphics::{Key, Window};
pub struct Game {
@@ -66,10 +63,7 @@ impl Game {
let use_item = self.window.is_key_pressed(Key::E);
let attack = self.window.is_key_pressed(Key::F);
let drop = self.window.is_key_pressed(Key::Q);
- let inv_slot = (0..PLAYER_INVENTORY_SIZE)
- .filter_map(|u16| u8::try_from(u16).ok())
- .find(|u8| self.window.is_key_pressed(Key::Number(*u8 + 1)))
- .map(|u8| u8 as usize);
+ let inv_slot = (0..9).find(|n| self.window.is_key_pressed(Key::Number(*n)));
PlayerInput {
direction,
interact,