summaryrefslogtreecommitdiff
path: root/src/list.rs
blob: cdf00a845c7d6006722e235105c742c0db5477cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
extern crate pancurses;

use character::Character;
use location::Location;

pub struct List{
    men : Vec<Character>,
    impassable : Vec<Location>,
}

impl List{
    pub fn new(impassable : Vec<Location>) -> List {
        let mut men = Vec::new();
        for i in 0..3 {
            let l = Location{x:150,y:150+i};
            let c = Character::new('@',4,l);
            men.push(c);
        }
        List{
            men : men,
            impassable : impassable,
        }
    }

    pub fn draw(&self, window : &pancurses::Window) {
        for man in self.men.iter(){
            man.draw(window);
        }
    }

    pub fn action(&self) {
        for man in self.men.iter(){
            man.action(self.men.to_vec(), self.impassable.to_vec());
        }
    }
}