error handling for endings
This commit is contained in:
@@ -2,7 +2,6 @@ use crate::{Dialogue, Ending, Font, Image, Item, Palette, Room, Sprite, TextDire
|
||||
|
||||
use loe::TransformMode;
|
||||
|
||||
use std::str::FromStr;
|
||||
use std::collections::HashMap;
|
||||
use std::borrow::BorrowMut;
|
||||
use std::fmt;
|
||||
@@ -226,8 +225,11 @@ impl Game {
|
||||
} else if segment.starts_with("DLG ") {
|
||||
dialogues.push(Dialogue::from(segment));
|
||||
} else if segment.starts_with("END ") {
|
||||
if let Ok(ending) = Ending::from_str(&segment) {
|
||||
let result = Ending::from_str(&segment);
|
||||
if let Ok(ending) = result {
|
||||
endings.push(ending);
|
||||
} else {
|
||||
warnings.push(result.unwrap_err());
|
||||
}
|
||||
} else if segment.starts_with("VAR ") {
|
||||
variables.push(Variable::from(segment));
|
||||
|
||||
Reference in New Issue
Block a user