From 86ddbbd163377bf8f50462e84d7dc6204c812367 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Fri, 24 Nov 2017 07:34:07 -0600 Subject: -made men not public, made path just given --- src/character.rs | 11 +---------- src/list.rs | 7 ++++++- src/main.rs | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) (limited to 'src') 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>) { - 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, + men : Vec, impassable_locations : Vec, threads : Vec>)>> } @@ -96,6 +97,10 @@ impl List { } } + pub fn get_men(&self) -> Iter { + 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); } -- cgit v1.2.3