better death messages, and morgue file map fix

This commit is contained in:
Llywelwyn 2023-08-26 17:48:04 +01:00
parent 9ac2adc5d6
commit 9e294a1680
7 changed files with 104 additions and 32 deletions

View file

@ -1195,3 +1195,16 @@ pub fn game_over(ctx: &mut Rltk) -> YesNoResult {
}
}
}
pub fn with_article(name: String) -> String {
// If first letter is a capital
if name.chars().nth(0).unwrap().is_uppercase() {
return format!("{}", name);
}
// a/an
let vowels = ['a', 'e', 'i', 'o', 'u'];
if vowels.contains(&name.chars().nth(0).unwrap()) {
return format!("an {}", name);
}
format!("a {}", name)
}