mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-07-02 13:59:07 +02:00
Add version field to file metadata
This commit is contained in:
parent
4d6644f427
commit
6077138292
6 changed files with 26 additions and 8 deletions
|
@ -6,7 +6,10 @@ use std::{
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use minedmap::{types::*, world::layer};
|
||||
use minedmap::{io::fs::FileMetaVersion, types::*, world::layer};
|
||||
|
||||
// Increase to force regeneration of all output files
|
||||
pub const FILE_META_VERSION: FileMetaVersion = FileMetaVersion(0);
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct TileCoords {
|
||||
|
|
|
@ -72,7 +72,7 @@ impl<'a> RegionProcessor<'a> {
|
|||
timestamp: SystemTime,
|
||||
) -> Result<()> {
|
||||
let output_path = self.config.processed_path(coords);
|
||||
storage::write(&output_path, processed_region, timestamp)
|
||||
storage::write(&output_path, processed_region, FILE_META_VERSION, timestamp)
|
||||
}
|
||||
|
||||
fn save_lightmap(
|
||||
|
@ -83,6 +83,7 @@ impl<'a> RegionProcessor<'a> {
|
|||
) -> Result<()> {
|
||||
fs::create_with_timestamp(
|
||||
&self.config.tile_path(TileKind::Lightmap, 0, coords),
|
||||
FILE_META_VERSION,
|
||||
timestamp,
|
||||
|file| {
|
||||
lightmap
|
||||
|
|
|
@ -109,7 +109,7 @@ impl<'a> TileMipmapper<'a> {
|
|||
);
|
||||
}
|
||||
|
||||
fs::create_with_timestamp(&output_path, timestamp, |file| {
|
||||
fs::create_with_timestamp(&output_path, FILE_META_VERSION, timestamp, |file| {
|
||||
image
|
||||
.write_to(file, image::ImageFormat::Png)
|
||||
.context("Failed to save image")
|
||||
|
|
|
@ -78,7 +78,7 @@ impl<'a> TileRenderer<'a> {
|
|||
let mut image = image::RgbaImage::new(N, N);
|
||||
Self::render_region(&mut image, ®ion);
|
||||
|
||||
fs::create_with_timestamp(&output_path, timestamp, |file| {
|
||||
fs::create_with_timestamp(&output_path, FILE_META_VERSION, timestamp, |file| {
|
||||
image
|
||||
.write_to(file, image::ImageFormat::Png)
|
||||
.context("Failed to save image")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue