Fix continent scale hack.

This commit is contained in:
Joshua Yanovski 2020-07-28 13:21:09 +02:00
parent 36b1cb074f
commit ad18ce9399

View File

@ -285,15 +285,14 @@ impl WorldMap_0_5_0 {
#[inline] #[inline]
pub fn into_modern(self) -> Result<ModernMap, WorldFileError> { pub fn into_modern(self) -> Result<ModernMap, WorldFileError> {
let pow_size = (self.alt.len().trailing_zeros()) / 2; let pow_size = (self.alt.len().trailing_zeros()) / 2;
let coord_size = 1 << pow_size;
let two_coord_size = 1 << (2 * pow_size); let two_coord_size = 1 << (2 * pow_size);
if self.alt.len() != self.basement.len() || self.alt.len() != two_coord_size { if self.alt.len() != self.basement.len() || self.alt.len() != two_coord_size {
return Err(WorldFileError::WorldSizeInvalid); return Err(WorldFileError::WorldSizeInvalid);
} }
// The recommended continent scale for maps from version 0.5.0 is (in all // The recommended continent scale for maps from version 0.5.0 is (in all
// existing cases) just 1.0 << (f64::from(coord_size) - 10.0). // existing cases) just 1.0 << (f64::from(pow_size) - 10.0).
let continent_scale_hack = (f64::from(coord_size) - 10.0).exp2(); let continent_scale_hack = (f64::from(pow_size) - 10.0).exp2();
let map = WorldMap_0_7_0 { let map = WorldMap_0_7_0 {
map_size_lg: Vec2::new(pow_size, pow_size), map_size_lg: Vec2::new(pow_size, pow_size),