Cleaned code up a bit
TODD: make colour an enum make unwrap_or_exit return the error
This commit is contained in:
@@ -20,7 +20,7 @@ use crate::
|
||||
pub fn character_parse
|
||||
(
|
||||
index: usize,
|
||||
tokens: &Vec<tokenise::Token>,
|
||||
tokens: &[tokenise::Token],
|
||||
character_name: String,
|
||||
characters: &Arc<Mutex<HashMap::<String, character::Character>>>,
|
||||
data_to_send: &Arc<Mutex<api::DataToSend>>,
|
||||
@@ -44,7 +44,7 @@ pub fn character_parse
|
||||
let output = tokenise::get_string_token(tokens, sum_index)
|
||||
.map_err(|err| (err, index))?;
|
||||
debug!("Saying {output}");
|
||||
api::modify_data(data_to_send, "output".to_string(), output.to_string(), character_name, vec![]);
|
||||
api::modify_data(data_to_send, "output".to_string(), output, character_name, vec![]);
|
||||
},
|
||||
// Change the property of the selected character eg @tim CHANGE name "Bill Buffins"
|
||||
// will change the character with ID tim to "Bill Buffins"; a character's ID cannot change
|
||||
@@ -71,7 +71,7 @@ pub fn character_parse
|
||||
sum_index += 1;
|
||||
let content = tokenise::get_string_token(tokens, sum_index)
|
||||
.map_err(|err| (err, index))?;
|
||||
api::modify_data(data_to_send, token.to_lowercase(), content.to_string(), character_name, vec![]);
|
||||
api::modify_data(data_to_send, token.to_lowercase(), content, character_name, vec![]);
|
||||
},
|
||||
// Catch all condition, if the instruction is unrecognised as a
|
||||
// character command
|
||||
|
||||
Reference in New Issue
Block a user