MCPcopy Create free account
hub / github.com/AdRoll/rustenstein / parse_map_head

Function parse_map_head

src/cache.rs:391–404  ·  view source on GitHub ↗
(path: P)

Source from the content-addressed store, hash-verified

389}
390
391fn 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)]
407struct MapLevelHeader {

Callers 1

load_mapsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected