add_dialogue()

This commit is contained in:
Max Bradbury 2020-06-24 19:43:36 +01:00
parent e32027e0af
commit b08e514b12
1 changed files with 11 additions and 0 deletions

View File

@ -548,6 +548,17 @@ impl Game {
new_id
}
/// adds a dialogue safely and returns the new dialogue ID
#[inline]
pub fn add_dialogue(&mut self, mut dialogue: Dialogue) -> String {
let new_id = try_id(self.dialogue_ids(), dialogue.id.clone());
if new_id != dialogue.id {
dialogue.id = new_id.clone();
}
self.dialogues.push(dialogue);
new_id
}
#[inline]
fn version_line(&self) -> String {
if self.version.is_some() {