blob: 8a160164e211d4ebd9943b87c8ea002c9f1b3825 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
use self::{map::Map, tee::Tees};
use crate::client::{helper::get_map_path, ClientMesgOut};
use std::fs::File;
pub mod map;
pub mod tee;
pub mod helper;
pub use gamenet::enums;
pub struct World {
pub map: Map,
pub tees: Tees,
}
impl World {
pub fn new() -> Self {
Self {
map: Map::empty(),
tees: Tees::new(),
}
}
pub fn update(&mut self, m: &ClientMesgOut) {
self.tees.update(m);
match m {
ClientMesgOut::MapChange { name, crc } => {
let file = File::open(get_map_path(name.as_str(), *crc)).unwrap();
self.map = Map::load(file).unwrap();
}
_ => (),
}
}
}
|