diff options
| author | troido <troido@protonmail.com> | 2020-02-22 12:55:10 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-22 12:55:10 +0100 |
| commit | 2b0cc677f4092d94b31e95f3e9961ec6ed91327b (patch) | |
| tree | 5c5e4683f5b8c9973ccfb260a876f88b599b0326 /src/controls.rs | |
| parent | a24e17014f37318d08fc8224d38e4062c959f34e (diff) | |
can now pick up specific object from ground
Diffstat (limited to 'src/controls.rs')
| -rw-r--r-- | src/controls.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/controls.rs b/src/controls.rs index b944a93..36d7c77 100644 --- a/src/controls.rs +++ b/src/controls.rs @@ -42,7 +42,7 @@ impl Direction { #[derive(Debug, Clone)] pub enum Control { Move(Direction), - Take(Option<u64>), + Take(Option<usize>), Drop(usize) } @@ -55,10 +55,7 @@ impl Control { Some(dir) => Some(Control::Move(dir)), None => None }, - "take" => Some(Control::Take(val.get(1)?.as_u64())), /*match val[1].as_u64() { - Some(rank) => Some(Control::Take(rank)), - _ => None - }*/ + "take" => Some(Control::Take(val.get(1)?.as_u64().map(|idx| idx as usize))), "drop" => Some(Control::Drop(val.get(1)?.as_u64().unwrap_or(0) as usize)), _ => None } |
