Merge branch 'neura/update-crates' into 'master'

Update various crates

See merge request veloren/veloren!4513
This commit is contained in:
Marcel 2024-06-24 04:58:20 +00:00
commit 5e41b34dc2
10 changed files with 144 additions and 143 deletions

167
Cargo.lock generated
View File

@ -860,9 +860,9 @@ dependencies = [
[[package]]
name = "chrono-tz"
version = "0.8.6"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e"
checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb"
dependencies = [
"chrono",
"chrono-tz-build",
@ -872,9 +872,9 @@ dependencies = [
[[package]]
name = "chrono-tz-build"
version = "0.2.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f"
checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1"
dependencies = [
"parse-zoneinfo",
"phf",
@ -1078,12 +1078,6 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "color_quant"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "colorchoice"
version = "1.0.1"
@ -1834,12 +1828,6 @@ dependencies = [
"winreg 0.52.0",
]
[[package]]
name = "dispatch"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04e93ca78226c51902d7aa8c12c988338aadd9e85ed9c6be8aaac39192ff3605"
[[package]]
name = "dispatch"
version = "0.2.0"
@ -2802,8 +2790,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.11",
"rayon",
"serde",
]
[[package]]
@ -2814,6 +2800,8 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash 0.8.11",
"allocator-api2",
"rayon",
"serde",
]
[[package]]
@ -3184,16 +3172,16 @@ dependencies = [
[[package]]
name = "image"
version = "0.24.9"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d"
checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11"
dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"jpeg-decoder",
"num-traits",
"png",
"zune-core",
"zune-jpeg",
]
[[package]]
@ -3392,6 +3380,15 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.11"
@ -3463,12 +3460,6 @@ dependencies = [
"libc",
]
[[package]]
name = "jpeg-decoder"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
[[package]]
name = "js-sys"
version = "0.3.69"
@ -4585,15 +4576,6 @@ dependencies = [
"num-traits",
]
[[package]]
name = "ordered-float"
version = "3.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc"
dependencies = [
"num-traits",
]
[[package]]
name = "ordered-float"
version = "4.2.0"
@ -5206,7 +5188,7 @@ dependencies = [
"lru",
"paste",
"stability",
"strum 0.26.2",
"strum",
"unicode-segmentation",
"unicode-width",
]
@ -6304,42 +6286,20 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
version = "0.24.1"
version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
dependencies = [
"strum_macros 0.24.3",
]
[[package]]
name = "strum"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29"
dependencies = [
"strum_macros 0.26.2",
"strum_macros",
]
[[package]]
name = "strum_macros"
version = "0.24.3"
version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
dependencies = [
"heck 0.4.1",
"proc-macro2 1.0.83",
"quote 1.0.36",
"rustversion",
"syn 1.0.109",
]
[[package]]
name = "strum_macros"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946"
dependencies = [
"heck 0.4.1",
"heck 0.5.0",
"proc-macro2 1.0.83",
"quote 1.0.36",
"rustversion",
@ -7075,7 +7035,7 @@ dependencies = [
"authc",
"byteorder",
"clap",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"hickory-resolver",
"image",
"num 0.4.3",
@ -7109,7 +7069,7 @@ dependencies = [
"fluent",
"fluent-bundle",
"fluent-syntax",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"intl-memoizer",
"serde",
"tracing",
@ -7133,14 +7093,14 @@ dependencies = [
"dot_vox",
"enum-map",
"fxhash",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"indexmap",
"itertools 0.10.5",
"itertools 0.13.0",
"kiddo",
"lazy_static",
"num-derive",
"num-traits",
"ordered-float 3.9.2",
"ordered-float 4.2.0",
"petgraph 0.6.5",
"rand 0.8.5",
"rand_chacha 0.3.1",
@ -7155,7 +7115,7 @@ dependencies = [
"slotmap",
"specs",
"spin_sleep",
"strum 0.24.1",
"strum",
"tracing",
"tracing-subscriber",
"uuid",
@ -7171,7 +7131,7 @@ version = "0.10.0"
dependencies = [
"assets_manager",
"dot_vox",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"image",
"lazy_static",
"ron",
@ -7226,7 +7186,7 @@ dependencies = [
name = "veloren-common-i18n"
version = "0.1.0"
dependencies = [
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"rand 0.8.5",
"serde",
]
@ -7237,7 +7197,7 @@ version = "0.10.0"
dependencies = [
"bincode",
"flate2",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"image",
"num-traits",
"serde",
@ -7256,7 +7216,7 @@ dependencies = [
"bincode",
"bytes",
"futures",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"hex",
"num_cpus",
"rayon",
@ -7282,8 +7242,8 @@ dependencies = [
name = "veloren-common-systems"
version = "0.10.0"
dependencies = [
"itertools 0.10.5",
"ordered-float 3.9.2",
"itertools 0.13.0",
"ordered-float 4.2.0",
"rand 0.8.5",
"rayon",
"specs",
@ -7308,7 +7268,7 @@ dependencies = [
"criterion",
"crossbeam-channel",
"futures-util",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"lazy_static",
"lz-fear",
"prometheus",
@ -7336,7 +7296,7 @@ dependencies = [
"bitflags 2.5.0",
"bytes",
"criterion",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"prometheus",
"rand 0.8.5",
"tokio",
@ -7363,8 +7323,8 @@ dependencies = [
"atomic_refcell",
"enum-map",
"fxhash",
"hashbrown 0.13.2",
"itertools 0.10.5",
"hashbrown 0.14.5",
"itertools 0.13.0",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rayon",
@ -7391,9 +7351,9 @@ dependencies = [
"drop_guard",
"enum-map",
"futures-util",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"humantime",
"itertools 0.10.5",
"itertools 0.13.0",
"lazy_static",
"noise",
"num_cpus",
@ -7412,7 +7372,7 @@ dependencies = [
"serde",
"serde_json",
"specs",
"strum 0.24.1",
"strum",
"tokio",
"tracing",
"vek 0.17.0",
@ -7433,7 +7393,7 @@ dependencies = [
name = "veloren-server-agent"
version = "0.1.0"
dependencies = [
"itertools 0.10.5",
"itertools 0.13.0",
"lazy_static",
"rand 0.8.5",
"specs",
@ -7497,7 +7457,7 @@ dependencies = [
"crossbeam-utils 0.8.20",
"directories-next",
"discord-sdk",
"dispatch 0.1.4",
"dispatch",
"dot_vox",
"egui",
"egui_wgpu_backend",
@ -7507,12 +7467,12 @@ dependencies = [
"gilrs",
"glyph_brush",
"guillotiere",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"iced_native",
"iced_winit",
"image",
"inline_tweak",
"itertools 0.10.5",
"itertools 0.13.0",
"keyboard-keynames",
"lazy_static",
"levenshtein",
@ -7521,7 +7481,7 @@ dependencies = [
"native-dialog",
"num 0.4.3",
"num_cpus",
"ordered-float 3.9.2",
"ordered-float 4.2.0",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rayon",
@ -7532,7 +7492,7 @@ dependencies = [
"shaderc",
"slab",
"specs",
"strum 0.24.1",
"strum",
"tokio",
"tracing",
"treeculler",
@ -7609,10 +7569,10 @@ dependencies = [
"fixed",
"flate2",
"fxhash",
"hashbrown 0.13.2",
"hashbrown 0.14.5",
"image",
"indicatif",
"itertools 0.10.5",
"itertools 0.13.0",
"kiddo",
"lazy_static",
"lz-fear",
@ -7620,7 +7580,7 @@ dependencies = [
"noise",
"num 0.4.3",
"num-traits",
"ordered-float 3.9.2",
"ordered-float 4.2.0",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rayon",
@ -7629,7 +7589,7 @@ dependencies = [
"rusqlite",
"serde",
"signal-hook",
"strum 0.24.1",
"strum",
"svg_fmt",
"tracing",
"tracing-subscriber",
@ -8857,7 +8817,7 @@ dependencies = [
"cfg_aliases",
"core-foundation",
"core-graphics 0.22.3",
"dispatch 0.2.0",
"dispatch",
"instant",
"libc",
"log",
@ -9169,3 +9129,18 @@ dependencies = [
"cc",
"pkg-config",
]
[[package]]
name = "zune-core"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a"
[[package]]
name = "zune-jpeg"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec866b44a2a1fd6133d363f073ca1b179f438f99e7e5bfb1e33f7181facfe448"
dependencies = [
"zune-core",
]

View File

@ -131,7 +131,7 @@ chrono = { version = "0.4.24", default-features = false, features = [
"wasmbind",
"serde",
] }
chrono-tz = { version = "0.8", features = ["serde"] }
chrono-tz = { version = "0.9", features = ["serde"] }
inline_tweak = { version = "1.0.8" }
tokio = { version = "1.28", default-features = false, features = ["rt"] }
@ -140,24 +140,24 @@ futures-util = { version = "0.3.7", default-features = false }
prometheus = { version = "0.13", default-features = false }
prometheus-hyper = "0.2"
strum = { version = "0.24", features = ["derive"] }
strum = { version = "0.26.3", features = ["derive"] }
enum-map = { version = "2.4" }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
hashbrown = { version = "0.14", features = ["rayon", "serde", "nightly"] }
fxhash = { version = "0.2.1" }
crossbeam-utils = { version = "0.8.1" }
crossbeam-channel = { version = "0.5" }
ordered-float = { version = "3", default-features = true }
ordered-float = { version = "4.2", default-features = true }
num = { version = "0.4" }
num-traits = { version = "0.2" }
vek = { version = "0.17.0", features = ["serde"] }
itertools = { version = "0.10" }
itertools = { version = "0.13" }
serde = { version = "1.0.118", features = ["derive"] }
serde_json = { version = "1.0.50" }
ron = { version = "0.8", default-features = false }
specs = { version = "0.20", features = ["nightly"] }
image = { version = "0.24", default-features = false, features = ["png"] }
image = { version = "0.25", default-features = false, features = ["png"] }
rayon = { version = "1.5" }
clap = { version = "4.2", features = ["derive"] }

View File

@ -9,7 +9,7 @@ use num_traits::cast::FromPrimitive;
use serde::{Deserialize, Serialize};
use std::{
fmt::Debug,
io::{Read, Write},
io::{Cursor, Read, Write},
marker::PhantomData,
};
use tracing::warn;
@ -142,7 +142,7 @@ pub trait VoxelImageDecoding: VoxelImageEncoding {
fn get_block(ws: &Self::Workspace, x: u32, y: u32, is_border: bool) -> Block;
}
pub fn image_from_bytes<'a, I: ImageDecoder<'a>, P: 'static + Pixel<Subpixel = u8>>(
pub fn image_from_bytes<I: ImageDecoder, P: 'static + Pixel<Subpixel = u8>>(
decoder: I,
) -> Option<ImageBuffer<P, Vec<u8>>> {
let (w, h) = decoder.dimensions();
@ -249,7 +249,12 @@ impl<const N: u32> VoxelImageEncoding for QuadPngEncoding<N> {
CompressionType::Fast,
FilterType::Up,
);
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8)
png.write_image(
x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len();
Some(())
@ -268,7 +273,7 @@ impl<const N: u32> VoxelImageEncoding for QuadPngEncoding<N> {
ws.3.as_raw(),
ws.3.width(),
ws.3.height(),
image::ColorType::Rgb8,
image::ExtendedColorType::Rgb8,
)
.ok()?;
}
@ -339,10 +344,10 @@ impl<const N: u32> VoxelImageDecoding for QuadPngEncoding<N> {
indices[1]..indices[2],
indices[2]..quad.len(),
];
let a = image_from_bytes(PngDecoder::new(&quad[ranges[0].clone()]).ok()?)?;
let b = image_from_bytes(PngDecoder::new(&quad[ranges[1].clone()]).ok()?)?;
let c = image_from_bytes(PngDecoder::new(&quad[ranges[2].clone()]).ok()?)?;
let d = image_from_bytes(PngDecoder::new(&quad[ranges[3].clone()]).ok()?)?;
let a = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[0].clone()])).ok()?)?;
let b = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[1].clone()])).ok()?)?;
let c = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[2].clone()])).ok()?)?;
let d = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[3].clone()])).ok()?)?;
Some((a, b, c, d, sprite_data, HashMap::new()))
}
@ -533,7 +538,12 @@ impl<const AVERAGE_PALETTE: bool> VoxelImageEncoding for TriPngEncoding<AVERAGE_
CompressionType::Fast,
FilterType::Up,
);
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8)
png.write_image(
x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len();
Some(())
@ -581,9 +591,9 @@ impl<const AVERAGE_PALETTE: bool> VoxelImageDecoding for TriPngEncoding<AVERAGE_
indices[0]..indices[1],
indices[1]..indices[2],
];
let a = image_from_bytes(PngDecoder::new(&quad[ranges[0].clone()]).ok()?)?;
let b = image_from_bytes(PngDecoder::new(&quad[ranges[1].clone()]).ok()?)?;
let c = image_from_bytes(PngDecoder::new(&quad[ranges[2].clone()]).ok()?)?;
let a = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[0].clone()])).ok()?)?;
let b = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[1].clone()])).ok()?)?;
let c = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[2].clone()])).ok()?)?;
let mut d: HashMap<_, HashMap<_, _>> = HashMap::new();
if AVERAGE_PALETTE {
for i in 0..=255 {

View File

@ -1,11 +1,11 @@
use serde::{Deserialize, Serialize};
use specs::{Component, DerefFlaggedStorage, VecStorage};
use strum::EnumVariantNames;
use strum::VariantNames;
// EnumVariantNames is used by bins for clap only, but using strum here gets rid
// VariantNames is used by bins for clap only, but using strum here gets rid
// of the clap dependency
#[derive(
Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize, EnumVariantNames,
Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize, VariantNames,
)]
pub enum AdminRole {
Moderator = 0,

View File

@ -147,7 +147,7 @@ discord-sdk = { version = "0.3.0", optional = true }
enum-map = { workspace = true }
[target.'cfg(target_os = "macos")'.dependencies]
dispatch = "0.1.4"
dispatch = "0.2"
[target.'cfg(target_family = "windows")'.build-dependencies]
winres = "0.1"

View File

@ -322,7 +322,7 @@ impl GraphicCache {
}
});
} else {
self.cache_map.drain_filter(|key, details| {
let _ = self.cache_map.extract_if(|key, details| {
if key.graphic_id == id {
match details {
// NOTE: if replace_graphic is used continously for small images (i.e.

View File

@ -17,7 +17,7 @@ use common::{
uniform_idx_as_vec2,
},
};
use image::{codecs::png::PngEncoder, ColorType, DynamicImage, GenericImage, ImageEncoder};
use image::{codecs::png::PngEncoder, DynamicImage, GenericImage, ImageEncoder};
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use rand::{thread_rng, Rng};
use rayon::ThreadPool;
@ -222,7 +222,7 @@ fn generate_one(
image.as_bytes(),
map_size_lg.chunks().x as u32,
map_size_lg.chunks().y as u32,
ColorType::Rgba8,
image::ExtendedColorType::Rgba8,
) {
error!(?error, "Could not write image data");
}

View File

@ -20,7 +20,7 @@ use rayon::ThreadPoolBuilder;
use serde::{Deserialize, Serialize};
use std::{
collections::BTreeMap,
io::{Read, Write},
io::{Cursor, Read, Write},
mem,
sync::Arc,
time::Instant,
@ -205,7 +205,7 @@ impl VoxelImageEncoding for PngEncoding {
ws.0.as_raw(),
ws.0.width(),
ws.0.height(),
image::ColorType::Rgba8,
image::ExtendedColorType::Rgba8,
)
.ok()?;
Some((buf, ws.1.clone()))
@ -308,7 +308,12 @@ impl VoxelImageEncoding for MixedEncoding {
CompressionType::Fast,
FilterType::Up,
);
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8)
png.write_image(
x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len();
Some(())
@ -337,14 +342,14 @@ impl VoxelImageDecoding for MixedEncoding {
indices[2]..indices[3],
indices[3]..quad.len(),
];
let a = image_from_bytes(PngDecoder::new(&quad[ranges[0].clone()]).ok()?)?;
let b = image_from_bytes(PngDecoder::new(&quad[ranges[1].clone()]).ok()?)?;
let c = image_from_bytes(PngDecoder::new(&quad[ranges[2].clone()]).ok()?)?;
let a = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[0].clone()])).ok()?)?;
let b = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[1].clone()])).ok()?)?;
let c = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[2].clone()])).ok()?)?;
let sprite_data =
bincode::deserialize::<CompressedData<Vec<[u8; 3]>>>(&quad[ranges[4].clone()])
.ok()?
.decompress()?;
let d = image_from_bytes(JpegDecoder::new(&quad[ranges[3].clone()]).ok()?)?;
let d = image_from_bytes(JpegDecoder::new(Cursor::new(&quad[ranges[3].clone()])).ok()?)?;
Some((a, b, c, d, sprite_data))
}
@ -417,7 +422,7 @@ impl VoxelImageEncoding for MixedEncodingSparseSprites {
ws.0.as_raw(),
ws.0.width(),
ws.0.height(),
image::ColorType::L8,
image::ExtendedColorType::L8,
)
.ok()?;
let index = buf.len();
@ -474,7 +479,12 @@ impl VoxelImageEncoding for MixedEncodingDenseSprites {
CompressionType::Fast,
FilterType::Up,
);
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8)
png.write_image(
x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len();
Some(())
@ -650,7 +660,12 @@ impl<'a, NN: NearestNeighbor, const N: u32> VoxelImageEncoding for PaletteEncodi
CompressionType::Fast,
FilterType::Up,
);
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8)
png.write_image(
x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len();
Some(())

View File

@ -87,7 +87,7 @@ fn image_from_function<F: FnMut(u32, u32) -> [u8; 3]>(
heightmap.as_raw(),
heightmap.width(),
heightmap.height(),
image::ColorType::Rgb8,
image::ExtendedColorType::Rgb8,
)
.unwrap();
let mut f = File::create(name).unwrap();

View File

@ -12,7 +12,7 @@ use tracing::{debug, error, info, warn};
use itertools::izip;
use noise::NoiseFn;
use num::{Float, Zero};
use ordered_float::NotNan;
use ordered_float::{FloatCore, NotNan};
use rayon::prelude::*;
use std::{
cmp::{Ordering, Reverse},
@ -1253,7 +1253,7 @@ fn erode(
// Egress with no outgoing flows.
// wh for oceans is always at least min_erosion_height.
let uplift_i = uplift(posi) as Alt;
wh[posi] = min_erosion_height.max(h_t_i + uplift_i);
wh[posi] = FloatCore::max(min_erosion_height, h_t_i + uplift_i);
lake_sill[stacki] = posi as isize;
lake_water_volume[stacki] = 0.0;
} else {
@ -1335,7 +1335,8 @@ fn erode(
if mask_kk.any() {
let h_j = rec_heights_kk;
let elev_j = h_j;
let dh = 0.0.max(new_h_i as SimdType - elev_j);
let dh =
FloatCore::max(0.0, new_h_i as SimdType - elev_j);
let powf = |a: SimdType, b| a.powf(b);
let dh_fs_sample = k_fs_fact_kk as SimdType
* powf(dh, n as SimdType - 1.0);
@ -1543,7 +1544,7 @@ fn erode(
// +max(0.d0,min(lake_sediment(lake_sill(ij)),
// lake_water_volume(lake_sill(ij))))/
// lake_water_volume(lake_sill(ij))*(water(ij)-h(ij))
*h += (0.0.max(lake_silt[stacki].min(lake_water_volume[lposi]))
*h += (FloatCore::max(0.0, lake_silt[stacki].min(lake_water_volume[lposi]))
/ lake_water_volume[lposi]
* (wh[posi] - *h) as Compute) as Alt;
}
@ -1613,7 +1614,7 @@ fn erode(
panic!("Disconnected lake!");
}
// wh for oceans is always at least min_erosion_height.
wh[posi] = min_erosion_height.max(old_h_i as Alt);
wh[posi] = FloatCore::max(min_erosion_height, old_h_i as Alt);
} else {
let posj = posj as usize;
// Find the water height for this chunk's receiver; we only apply thermal
@ -1818,7 +1819,7 @@ pub(crate) fn fill_sinks<F: Float + Send + Sync>(
/// adjacency list).
/// - The adjacency list (stored in a single vector), indexed by the second
/// indirection vector.
pub fn get_lakes<F: Float>(
pub fn get_lakes<F: FloatCore>(
map_size_lg: MapSizeLg,
h: impl Fn(usize) -> F,
downhill: &mut [isize],