From 2e5f1363e6efff3daefee9fe6388be2332e6fb62 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Thu, 2 Nov 2017 05:51:32 -0500 Subject: -units now move respect impassable locations, syntax more uniform --- src/character.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/character.rs') diff --git a/src/character.rs b/src/character.rs index 2f2289f..4c7f7dc 100644 --- a/src/character.rs +++ b/src/character.rs @@ -4,9 +4,9 @@ use character::rand::Rng; use location::Location; pub struct Character{ - pub symbol : char, - pub color : u8, - pub location : Location, + pub symbol : char, + pub color : u8, + pub location : Location, } impl Copy for Character {} @@ -19,18 +19,18 @@ impl Clone for Character { impl Character { pub fn new(symbol : char, color : u8, location : Location) -> Character { Character { - symbol : symbol, - color : color, - location : location, + symbol : symbol, + color : color, + location : location, } } - pub fn action(&mut self, free_spaces : Vec){ + pub fn action(&mut self, free_spaces : Vec) { self.wander(free_spaces); } - fn wander(&mut self, free_spaces : Vec){ - let direction = rand::thread_rng().gen_range(0,free_spaces.len()); + fn wander(&mut self, free_spaces : Vec) { + let direction = rand::thread_rng().gen_range(0, free_spaces.len()); self.location = free_spaces[direction]; } } -- cgit v1.2.3