//! Implements a map graph and world logic use crate::{ data::{Link, Node}, server::{Result, ServerErr}, wire::Response }; use async_std::sync::Arc; use serde::{Deserialize, Serialize}; use std::collections::BTreeMap; /// A map that people fight on /// /// A map is defined by it's graph relationships, but also where on /// the map nodes are placed, how much spacing there is, etc. All /// this information is encoded in the same structs because it's /// static, and just more convenient. #[derive(Default, Serialize, Deserialize)] pub struct Map { /// Node IDs mapped to node objects nodes: BTreeMap>, /// Link IDs mapped to link objects links: BTreeMap>, } impl Map { pub fn new() -> Arc { Arc::new(Self::default()) } pub fn update(&mut self, cb: F) -> Result where F: Fn(&mut Map) -> Result, { unimplemented!() } }