handle errors for game

This commit is contained in:
Max Bradbury 2020-04-18 18:07:25 +01:00
parent 4f8c4e5195
commit f550c3696f
2 changed files with 4 additions and 2 deletions

View File

@ -12,7 +12,9 @@ fn main() {
.nth(2)
.expect("No output path specified. Usage: `smiley infile outfile`");
let mut game = Game::from(fs::read_to_string(input_file).unwrap());
let mut game = Game::from(
fs::read_to_string(input_file).unwrap()
).unwrap();
game.avatar.animation_frames = vec![Image {
pixels: vec![

View File

@ -41,7 +41,7 @@ pub struct Game {
}
impl Game {
fn from(string: String) -> Result<Game, &'static dyn Error> {
pub fn from(string: String) -> Result<Game, &'static dyn Error> {
let mut string = format!("{}\n\n", string.trim_matches('\n'));
if string.starts_with("# BITSY VERSION") {