error handling for Item

This commit is contained in:
2020-10-18 15:47:39 +01:00
parent 68ecc64c7b
commit 889328f9a9
2 changed files with 20 additions and 16 deletions

View File

@@ -221,7 +221,13 @@ impl Game {
sprites.push(sprite);
}
} else if segment.starts_with("ITM ") {
items.push(Item::from(segment));
let result = Item::from_str(&segment);
if let Ok(item) = result {
items.push(item);
} else {
warnings.push(result.unwrap_err());
}
} else if segment.starts_with("DLG ") {
let result = Dialogue::from_str(&segment);