comparison src/th06/enemy.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
499 fn enemy() { 499 fn enemy() {
500 let file = File::open("EoSD/ST/stg1enm.anm").unwrap(); 500 let file = File::open("EoSD/ST/stg1enm.anm").unwrap();
501 let mut file = io::BufReader::new(file); 501 let mut file = io::BufReader::new(file);
502 let mut buf = vec![]; 502 let mut buf = vec![];
503 file.read_to_end(&mut buf).unwrap(); 503 file.read_to_end(&mut buf).unwrap();
504 let anm0 = Anm0::from_slice(&buf).unwrap(); 504 let (_, mut anms) = Anm0::from_slice(&buf).unwrap();
505 let anm0 = anms.pop().unwrap();
505 let anm0 = Rc::new(RefCell::new(anm0)); 506 let anm0 = Rc::new(RefCell::new(anm0));
506 let prng = Rc::new(RefCell::new(Prng::new(0))); 507 let prng = Rc::new(RefCell::new(Prng::new(0)));
507 let game = Game::new(prng, Rank::Easy); 508 let game = Game::new(prng, Rank::Easy);
508 let game = Rc::new(RefCell::new(game)); 509 let game = Rc::new(RefCell::new(game));
509 let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game)); 510 let enemy = Enemy::new(Position::new(0., 0.), 500, 0, 640, Rc::downgrade(&anm0), Rc::downgrade(&game));