(path: P)
| 389 | } |
| 390 | |
| 391 | fn parse_map_head<P: AsRef<Path>>(path: P) -> MapHead { |
| 392 | let raw_data = fs::read(path).expect("could not read MAPHEAD file"); |
| 393 | |
| 394 | MapHead { |
| 395 | magic: raw_data[0..2].try_into().unwrap(), |
| 396 | pointers: raw_data[2..=(4 * 100)] |
| 397 | .chunks_exact(4) |
| 398 | .take(NUM_MAPS) |
| 399 | .map(|x| i32::from_le_bytes(x.try_into().unwrap())) |
| 400 | .filter(|&x| x > 0) |
| 401 | .collect(), |
| 402 | title: raw_data[(2 + (4 * 100))..].to_owned(), |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | #[derive(Debug)] |
| 407 | struct MapLevelHeader { |