about summary refs log tree commit diff
path: root/src/types/mod.rs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-07-14T15·00-0400
committerGriffin Smith <root@gws.fyi>2019-07-14T15·00-0400
commit405dbffe376b05af31dc57f027658c70b4fb9634 (patch)
treee8d1e50b66e2b9e64d01336108f3176c4a07e78e /src/types/mod.rs
parentbf03ebc549bfeef38b91110511a56a6cd24dc58d (diff)
Add commands for diagonal movement
Cribbed directly from Nethack

This was really, really easy.
Diffstat (limited to 'src/types/mod.rs')
-rw-r--r--src/types/mod.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/types/mod.rs b/src/types/mod.rs
index 67c773fdb107..ac44bcc9c89e 100644
--- a/src/types/mod.rs
+++ b/src/types/mod.rs
@@ -8,7 +8,7 @@ pub mod direction;
 pub mod entity_map;
 pub use collision::Collision;
 pub use direction::Direction;
-pub use direction::Direction::{Down, Left, Right, Up};
+pub use direction::Direction::*;
 use proptest_derive::Arbitrary;
 use termion::cursor;
 
@@ -217,6 +217,10 @@ impl ops::Add<Direction> for Position {
                     self
                 }
             }
+            UpLeft => self + Up + Left,
+            UpRight => self + Up + Right,
+            DownLeft => self + Down + Left,
+            DownRight => self + Down + Right,
         }
     }
 }