summaryrefslogtreecommitdiff
path: root/src/character.rs
diff options
context:
space:
mode:
authorTom Barrett <tombarrett@siu.edu>2017-11-02 05:51:32 -0500
committerTom Barrett <tombarrett@siu.edu>2017-11-02 05:51:32 -0500
commit2e5f1363e6efff3daefee9fe6388be2332e6fb62 (patch)
treef0e255472120577d3b8699df9bda746b847ed730 /src/character.rs
parent5c495b75f25c324b5e468d0aa80d0699bb5f3fd2 (diff)
-units now move respect impassable locations, syntax more uniform
Diffstat (limited to 'src/character.rs')
-rw-r--r--src/character.rs18
1 files changed, 9 insertions, 9 deletions
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<Location>){
+ pub fn action(&mut self, free_spaces : Vec<Location>) {
self.wander(free_spaces);
}
- fn wander(&mut self, free_spaces : Vec<Location>){
- let direction = rand::thread_rng().gen_range(0,free_spaces.len());
+ fn wander(&mut self, free_spaces : Vec<Location>) {
+ let direction = rand::thread_rng().gen_range(0, free_spaces.len());
self.location = free_spaces[direction];
}
}