mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
main: add map_path() method to Config struct
This commit is contained in:
parent
51a0e178b1
commit
dda81546de
1 changed files with 18 additions and 1 deletions
19
src/main.rs
19
src/main.rs
|
@ -46,6 +46,16 @@ impl Config {
|
|||
);
|
||||
[&self.processed_dir, Path::new(&filename)].iter().collect()
|
||||
}
|
||||
|
||||
fn map_path(&self, coords: RegionCoords, temp: bool) -> PathBuf {
|
||||
let filename = format!(
|
||||
"r.{}.{}.png{}",
|
||||
coords.0,
|
||||
coords.1,
|
||||
if temp { ".tmp" } else { "" },
|
||||
);
|
||||
[&self.map_dir, Path::new(&filename)].iter().collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Type with methods for processing the regions of a Minecraft save directory
|
||||
|
@ -178,7 +188,14 @@ impl<'a> TileRenderer<'a> {
|
|||
}
|
||||
|
||||
fn render_tile(&self, coords: RegionCoords) -> Result<()> {
|
||||
println!("Rendering tile r.{}.{}.png", coords.0, coords.1);
|
||||
let output_path = self.config.map_path(coords, false);
|
||||
println!(
|
||||
"Rendering tile {}",
|
||||
output_path
|
||||
.file_name()
|
||||
.unwrap_or_default()
|
||||
.to_string_lossy(),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue