Skip to content

Commit

Permalink
use semantic versioning for version check
Browse files Browse the repository at this point in the history
  • Loading branch information
Uriopass committed May 15, 2023
1 parent fcf5d4a commit 1c7aa8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.0
0.6.1
17 changes: 11 additions & 6 deletions egregoria/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ use crate::transportation::train::RailWagon;
use crate::utils::scheduler::RunnableSystem;
use crate::utils::time::Tick;
use common::FastMap;
use serde::de::Error;
pub use utils::par_command_buffer::ParCommandBuffer;

pub use utils::config::*;
Expand Down Expand Up @@ -410,11 +409,17 @@ impl<'de> Deserialize<'de> for Egregoria {
t.elapsed().as_secs_f32()
);

if goriadeser.version != VERSION {
return Err(Error::custom(format!(
"couldn't load save, incompatible version! save is: {} - game is: {}",
goriadeser.version, VERSION
)));
let cur_version_parts = VERSION.split('.').collect::<Vec<_>>();
let deser_parts = goriadeser.version.split('.').collect::<Vec<_>>();

if cur_version_parts[0] != deser_parts[0]
|| (cur_version_parts[0] == "0" && cur_version_parts[1] != deser_parts[1])
{
log::warn!(
"incompatible version, save might be corrupted! save is: {} - game is: {}",
goriadeser.version,
VERSION
);
}

let mut goria = Self {
Expand Down

0 comments on commit 1c7aa8f

Please sign in to comment.