From 2c28394705ff4a2faa998a8ed31bdf9cf8c993dd Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 14 Apr 2024 21:14:46 +0200 Subject: [PATCH] cleanup --- src/chat.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 102d17e..0caff66 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -246,13 +246,13 @@ impl ChatDB { // - `"What's up?"` // - `{"goto": "foo"}` fn is_choice(&self, yaml: Option<&Value>) -> bool { - if let Some(data) = self.extract(yaml) { + if let Some(data) = self.extract_choice(yaml) { return data.choice_text.is_some(); } return false; } - fn extract(&self, yaml: Option<&Value>) -> Option { + fn extract_choice(&self, yaml: Option<&Value>) -> Option { let non_choice_tokens = NON_CHOICE_TOKENS.to_vec(); if let Some(Value::Mapping(map)) = yaml { let mut result: Extracted = Extracted::default(); @@ -571,7 +571,7 @@ impl ChatDB { // Spawn choices until we reach a non-choice item or the end of the branch let mut key: usize = 0; let mut reached_end_of_branch = false; - while let Some(data) = self.extract(self.at(chat.internal_id, &chat.position).as_ref()) { + while let Some(data) = self.extract_choice(self.at(chat.internal_id, &chat.position).as_ref()) { if let Some(choice_text) = data.choice_text { if reached_end_of_branch { break; @@ -697,7 +697,6 @@ pub fn handle_chat_events( } ChatEvent::SpawnChoice(replytext, key, goto, nowait, condition) => { 'out: { - dbg!(condition); if let Some(condition) = condition { if !vars.evaluate_condition(condition, &chat.talker.actor_id) { break 'out;