summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/character.rs11
-rw-r--r--src/list.rs7
-rw-r--r--src/main.rs2
3 files changed, 8 insertions, 12 deletions
diff --git a/src/character.rs b/src/character.rs
index 6a71d4c..421ede4 100644
--- a/src/character.rs
+++ b/src/character.rs
@@ -1,7 +1,6 @@
extern crate rand;
use character::rand::Rng;
-
use constants::Orders;
use location::Location;
@@ -70,15 +69,7 @@ impl Character {
}
pub fn give_path(&mut self, path : Option<Vec<Location>>) {
- match path {
- Some(path) => {
- self.path = Some(path);
- },
- None => {
- self.path = None;
- self.order = Orders::Wander as u8;
- },
- }
+ self.path = path;
}
pub fn give_destination(&mut self, destination : Location) {
diff --git a/src/list.rs b/src/list.rs
index 1383394..f9990b1 100644
--- a/src/list.rs
+++ b/src/list.rs
@@ -1,4 +1,5 @@
use std::thread::{spawn, JoinHandle};
+use std::slice::Iter;
extern crate pancurses;
@@ -10,7 +11,7 @@ use character::Character;
use constants::Colors;
pub struct List{
- pub men : Vec<Character>,
+ men : Vec<Character>,
impassable_locations : Vec<Location>,
threads : Vec<JoinHandle<(usize, Option<Vec<Location>>)>>
}
@@ -96,6 +97,10 @@ impl List {
}
}
+ pub fn get_men(&self) -> Iter<Character> {
+ self.men.iter()
+ }
+
fn get_free_locations(&mut self, location : Location) -> Vec<(Location, usize)> {
let mut potential_locations = location.neighbours(Vec::new());
diff --git a/src/main.rs b/src/main.rs
index 3175477..d4c5513 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -95,7 +95,7 @@ fn main() {
}
}
- for man in list.men.iter() {
+ for man in list.get_men() {
map.draw(man);
}