This commit is contained in:
parent
57cd19ded7
commit
ebbc05cd11
1 changed files with 4 additions and 6 deletions
|
|
@ -45,11 +45,10 @@ impl CoreConfig {
|
|||
let quest_config: QuestConfig =
|
||||
serde_json::from_str(rest.pop_front().ok_or("No Quest Config")?)?;
|
||||
|
||||
let area_configs: Vec<AreaConfig> = rest
|
||||
let area_configs = rest
|
||||
.iter()
|
||||
.map(|s| serde_json::from_str(s))
|
||||
.filter_map(|s| s.ok())
|
||||
.collect();
|
||||
.collect::<Result<Vec<AreaConfig>, _>>()?;
|
||||
|
||||
if rest.len() != area_configs.len() {
|
||||
return Err("Failed Parsing Area Configs".into());
|
||||
|
|
@ -67,12 +66,11 @@ impl CoreConfig {
|
|||
pub(crate) fn to_string(&self) -> Result<String, Box<dyn Error>> {
|
||||
let game_config = serde_json::to_string(&self.game_config)?;
|
||||
|
||||
let area_config: Vec<String> = self
|
||||
let area_config = self
|
||||
.area_configs
|
||||
.iter()
|
||||
.map(|a| serde_json::to_string(a))
|
||||
.filter_map(|a| a.ok())
|
||||
.collect();
|
||||
.collect::<Result<Vec<String>, _>>()?;
|
||||
|
||||
let rest_config = [
|
||||
serde_json::to_string(&self.player_config)?,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue