handle errors for game
This commit is contained in:
parent
4f8c4e5195
commit
f550c3696f
|
@ -12,7 +12,9 @@ fn main() {
|
||||||
.nth(2)
|
.nth(2)
|
||||||
.expect("No output path specified. Usage: `smiley infile outfile`");
|
.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 {
|
game.avatar.animation_frames = vec![Image {
|
||||||
pixels: vec![
|
pixels: vec![
|
||||||
|
|
|
@ -41,7 +41,7 @@ pub struct Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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'));
|
let mut string = format!("{}\n\n", string.trim_matches('\n'));
|
||||||
|
|
||||||
if string.starts_with("# BITSY VERSION") {
|
if string.starts_with("# BITSY VERSION") {
|
||||||
|
|
Loading…
Reference in New Issue