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 =
|
let quest_config: QuestConfig =
|
||||||
serde_json::from_str(rest.pop_front().ok_or("No Quest Config")?)?;
|
serde_json::from_str(rest.pop_front().ok_or("No Quest Config")?)?;
|
||||||
|
|
||||||
let area_configs: Vec<AreaConfig> = rest
|
let area_configs = rest
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| serde_json::from_str(s))
|
.map(|s| serde_json::from_str(s))
|
||||||
.filter_map(|s| s.ok())
|
.collect::<Result<Vec<AreaConfig>, _>>()?;
|
||||||
.collect();
|
|
||||||
|
|
||||||
if rest.len() != area_configs.len() {
|
if rest.len() != area_configs.len() {
|
||||||
return Err("Failed Parsing Area Configs".into());
|
return Err("Failed Parsing Area Configs".into());
|
||||||
|
|
@ -67,12 +66,11 @@ impl CoreConfig {
|
||||||
pub(crate) fn to_string(&self) -> Result<String, Box<dyn Error>> {
|
pub(crate) fn to_string(&self) -> Result<String, Box<dyn Error>> {
|
||||||
let game_config = serde_json::to_string(&self.game_config)?;
|
let game_config = serde_json::to_string(&self.game_config)?;
|
||||||
|
|
||||||
let area_config: Vec<String> = self
|
let area_config = self
|
||||||
.area_configs
|
.area_configs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|a| serde_json::to_string(a))
|
.map(|a| serde_json::to_string(a))
|
||||||
.filter_map(|a| a.ok())
|
.collect::<Result<Vec<String>, _>>()?;
|
||||||
.collect();
|
|
||||||
|
|
||||||
let rest_config = [
|
let rest_config = [
|
||||||
serde_json::to_string(&self.player_config)?,
|
serde_json::to_string(&self.player_config)?,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue