Compare commits

..

No commits in common. "46f8831c7b4b810d2387969dfe71b5d80627ef85" and "1bbfaceeb47c6a1e0e8c07b0859fe35479d0ec5a" have entirely different histories.

4 changed files with 11 additions and 10 deletions

View File

@ -27,7 +27,6 @@ pub enum Error {
Dialogue, Dialogue,
Ending, Ending,
Exit, Exit,
Font,
Game { Game {
missing: NotFound, missing: NotFound,
}, },

View File

@ -255,7 +255,7 @@ impl Game {
} }
if ! avatar_exists { if ! avatar_exists {
warnings.push(crate::Error::Game { missing: NotFound::Avatar }); warnings.push(crate::Error::Game { missing: NotFound::Avatar});
} }
Ok( Ok(

View File

@ -51,7 +51,9 @@ impl Sprite {
format!("\n{}", lines.join("\n")) format!("\n{}", lines.join("\n"))
} }
} }
}
impl Sprite {
pub fn from_str(str: &str) -> Result<Sprite, crate::Error> { pub fn from_str(str: &str) -> Result<Sprite, crate::Error> {
let mut lines: Vec<&str> = str.lines().collect(); let mut lines: Vec<&str> = str.lines().collect();

View File

@ -13,19 +13,19 @@ impl Font {
match str { match str {
"unicode_european_small" => Font::UnicodeEuropeanSmall, "unicode_european_small" => Font::UnicodeEuropeanSmall,
"unicode_european_large" => Font::UnicodeEuropeanLarge, "unicode_european_large" => Font::UnicodeEuropeanLarge,
"unicode_asian" => Font::UnicodeAsian, "unicode_asian" => Font::UnicodeAsian,
"arabic" => Font::Arabic, "arabic" => Font::Arabic,
_ => Font::Custom, _ => Font::Custom,
} }
} }
pub(crate) fn to_string(&self) -> Result<String, crate::Error> { pub(crate) fn to_string(&self) -> Result<String, &'static str> {
match &self { match &self {
Font::UnicodeEuropeanSmall => Ok("unicode_european_small".to_string()), Font::UnicodeEuropeanSmall => Ok("unicode_european_small".to_string()),
Font::UnicodeEuropeanLarge => Ok("unicode_european_large".to_string()), Font::UnicodeEuropeanLarge => Ok("unicode_european_large".to_string()),
Font::UnicodeAsian => Ok("unicode_asian".to_string()), Font::UnicodeAsian => Ok("unicode_asian".to_string()),
Font::Arabic => Ok("arabic".to_string()), Font::Arabic => Ok("arabic".to_string()),
_ => Err(crate::Error::Font), _ => Err("No string available for this Font"),
} }
} }
} }