summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorTom Barrett <tombarrett@siu.edu>2017-11-24 03:42:02 -0600
committerTom Barrett <tombarrett@siu.edu>2017-11-24 03:42:02 -0600
commitae4e10f00eab3c9a7a9f5239392e67ef3c39fb1a (patch)
treee6ca958fe534adc91f898c3212a0f115122af9fa /src/main.rs
parenta853a837b8cb991d8c55496401bef02275139c4e (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.rs16
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 => (),
}
}