From fb20a0f84419dab4c8949d9a9ca30d3b75f9665c Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Thu, 23 Nov 2017 05:33:51 -0600 Subject: -i believe this will be faster --- src/list.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/list.rs b/src/list.rs index c22c229..6c07c01 100644 --- a/src/list.rs +++ b/src/list.rs @@ -26,10 +26,12 @@ impl List { let location = self.men[i].location.clone(); let free_locations = self.get_free_locations(location); self.men[i].action(free_locations); + } + let impassable = self.get_all_impassable(); + for i in 0..self.men.len() { if self.men[i].needs_path { - let impassable = self.get_all_impassable(); - self.men[i].calculate_path(impassable); + self.men[i].calculate_path(impassable.to_vec()); } } } -- cgit v1.2.3