diff --git a/world/src/lib.rs b/world/src/lib.rs index c1fe4091d9..cc7bcfaf1f 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -118,20 +118,16 @@ impl World { self.civs() .caves .iter() - .map(|(_, info)| world_msg::SiteInfo { - name: Some(info.name.clone()), + .map(|(_, info)| { + // separate the two locations, combine with name + std::iter::once((info.name.clone(), info.location.0)) + .chain(std::iter::once((info.name.clone(), info.location.1))) + }) + .flatten() // unwrap inner iteration + .map(|(name, pos)| world_msg::SiteInfo { + name: Some(name), kind: world_msg::SiteKind::Cave, - wpos: info.location.0, - }), - ) - .chain( - self.civs() - .caves - .iter() - .map(|(_, info)| world_msg::SiteInfo { - name: Some(info.name.clone()), - kind: world_msg::SiteKind::Cave, - wpos: info.location.1, + wpos: pos, }), ) .collect(),