give warning on missing avatar
This commit is contained in:
parent
e9738b98b1
commit
1bbfaceeb4
12
src/game.rs
12
src/game.rs
|
@ -5,6 +5,7 @@ use loe::TransformMode;
|
|||
use std::collections::HashMap;
|
||||
use std::borrow::BorrowMut;
|
||||
use std::fmt;
|
||||
use crate::error::NotFound;
|
||||
|
||||
/// in very early versions of Bitsy, room tiles were defined as single alphanumeric characters -
|
||||
/// so there was a maximum of 36 unique tiles. later versions are comma-separated.
|
||||
|
@ -170,7 +171,7 @@ impl Game {
|
|||
let mut tiles: Vec<Tile> = Vec::new();
|
||||
let mut sprites: Vec<Sprite> = Vec::new();
|
||||
let mut items: Vec<Item> = Vec::new();
|
||||
// let mut avatar_exists = false;
|
||||
let mut avatar_exists = false;
|
||||
|
||||
for segment in segments {
|
||||
if segment.starts_with("# BITSY VERSION") {
|
||||
|
@ -216,7 +217,7 @@ impl Game {
|
|||
let result = Sprite::from_str(&segment);
|
||||
|
||||
if let Ok(sprite) = result {
|
||||
// avatar_exists |= sprite.id == "A";
|
||||
avatar_exists |= sprite.id == "A";
|
||||
|
||||
sprites.push(sprite);
|
||||
} else {
|
||||
|
@ -240,6 +241,7 @@ impl Game {
|
|||
}
|
||||
} else if segment.starts_with("END ") {
|
||||
let result = Ending::from_str(&segment);
|
||||
|
||||
if let Ok(ending) = result {
|
||||
endings.push(ending);
|
||||
} else {
|
||||
|
@ -252,9 +254,9 @@ impl Game {
|
|||
}
|
||||
}
|
||||
|
||||
// if ! avatar_exists {
|
||||
// return Err(crate::Error::NotFound::Avatar);
|
||||
// }
|
||||
if ! avatar_exists {
|
||||
warnings.push(crate::Error::Game { missing: NotFound::Avatar});
|
||||
}
|
||||
|
||||
Ok(
|
||||
(
|
||||
|
|
Loading…
Reference in New Issue