added a modify data function for changing the data_to_send mutex
This commit is contained in:
@@ -44,12 +44,7 @@ pub fn character_parse
|
||||
{
|
||||
debug!("{output_string}");
|
||||
sum_index += counter;
|
||||
let mut data = data_to_send.lock().unwrap_or_exit("Data to send Mutex was poisoned", 2);
|
||||
data.action_type = String::from("output");
|
||||
data.content = output_string;
|
||||
data.character = character_name;
|
||||
data.choices = vec![];
|
||||
drop(data);
|
||||
api::modify_data(data_to_send, "output".to_string(), output_string, character_name, vec![]);
|
||||
},
|
||||
None => return Err(("Unable to read output string".to_string(), sum_index)),
|
||||
}
|
||||
@@ -74,11 +69,15 @@ pub fn character_parse
|
||||
&& character.set_field(feature, &output_string)
|
||||
.is_err() { warn!("Feature {feature} does not exist") }
|
||||
drop(characters);
|
||||
let mut data = data_to_send.lock().unwrap_or_exit("Data to send Mutex was poisoned",2); // TODO eh?
|
||||
data.action_type = String::from("change");
|
||||
data.content = String::new();
|
||||
data.character = character_name;
|
||||
drop(data);
|
||||
api::modify_data(data_to_send, "change".to_string(), String::new(), character_name, vec![]);
|
||||
},
|
||||
"to"|"animate" =>
|
||||
{
|
||||
sum_index += 1;
|
||||
let content = tokens
|
||||
.get(sum_index)
|
||||
.ok_or_else(|| ("File unexpectedly reached termination point".to_string(), sum_index))?;
|
||||
api::modify_data(data_to_send, token.to_lowercase(), content.to_string(), character_name, vec![]);
|
||||
},
|
||||
// Catch all condition, if the instruction is unrecognised as a
|
||||
// character command
|
||||
|
||||
Reference in New Issue
Block a user