comparison src/th06/ecl_vm.rs @ 701:b6c351ca0a35

anm0: return the nom IResult and the list of Anm0s.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 23 Aug 2019 15:34:03 +0200
parents 2a60f12bd5bd
children 81232dac8136
comparison
equal deleted inserted replaced
700:ccb739c5b66c 701:b6c351ca0a35
975 fn setup() -> (Rc<RefCell<Game>>, Rc<RefCell<Enemy>>) { 975 fn setup() -> (Rc<RefCell<Game>>, Rc<RefCell<Enemy>>) {
976 let file = File::open("EoSD/ST/stg1enm.anm").unwrap(); 976 let file = File::open("EoSD/ST/stg1enm.anm").unwrap();
977 let mut file = io::BufReader::new(file); 977 let mut file = io::BufReader::new(file);
978 let mut buf = vec![]; 978 let mut buf = vec![];
979 file.read_to_end(&mut buf).unwrap(); 979 file.read_to_end(&mut buf).unwrap();
980 let anm0 = Anm0::from_slice(&buf).unwrap(); 980 let (_, mut anms) = Anm0::from_slice(&buf).unwrap();
981 let anm0 = anms.pop().unwrap();
981 let anm0 = Rc::new(RefCell::new(anm0)); 982 let anm0 = Rc::new(RefCell::new(anm0));
982 let prng = Rc::new(RefCell::new(Prng::new(0))); 983 let prng = Rc::new(RefCell::new(Prng::new(0)));
983 let game = Game::new(prng, Rank::Easy); 984 let game = Game::new(prng, Rank::Easy);
984 let game = Rc::new(RefCell::new(game)); 985 let game = Rc::new(RefCell::new(game));
985 let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game)); 986 let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game));