diff options
author | Tom Barrett <tombarrett@siu.edu> | 2017-11-24 03:42:02 -0600 |
---|---|---|
committer | Tom Barrett <tombarrett@siu.edu> | 2017-11-24 03:42:02 -0600 |
commit | ae4e10f00eab3c9a7a9f5239392e67ef3c39fb1a (patch) | |
tree | e6ca958fe534adc91f898c3212a0f115122af9fa /src/main.rs | |
parent | a853a837b8cb991d8c55496401bef02275139c4e (diff) |
-made all character variables private
-moved path calculation to list level
-moved needs_path to a function
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 6148aac..81ce270 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,10 +47,10 @@ fn main() { let command = match main.getch() { Some(Input::Character(ch)) => { match ch { - 'h' => {cursor.location.1 -= 1; None} - 'l' => {cursor.location.1 += 1; None} - 'k' => {cursor.location.0 -= 1; None} - 'j' => {cursor.location.0 += 1; None} + 'k' => {cursor.up(); None} + 'j' => {cursor.down(); None} + 'h' => {cursor.left(); None} + 'l' => {cursor.right();None} 'q' => break, 'o' => Some(Commands::Go), 's' => Some(Commands::Grid), @@ -65,17 +65,17 @@ fn main() { map.fill(); match command { - Some(Commands::Go) => list.give_destination(cursor.location), + Some(Commands::Go) => list.give_destination(cursor.get_location()), Some(Commands::Grid) => { paused = true; draw_box = true; - first_location = Some(cursor.location); + first_location = Some(cursor.get_location()); }, Some(Commands::Finish) => { paused = false; draw_box = false; match first_location { - Some(first_location) => list.give_grid(first_location, cursor.location), + Some(first_location) => list.give_grid(first_location, cursor.get_location()), None => (), } }, @@ -90,7 +90,7 @@ fn main() { if draw_box { match first_location { - Some(first_location) => map.draw_box(first_location, cursor.location), + Some(first_location) => map.draw_box(first_location, cursor.get_location()), None => (), } } |