Merge branch 'xMAC/update-toolchain' into 'master'

update toolchain to `2024-05-14`

See merge request veloren/veloren!4466
This commit is contained in:
Marcel 2024-05-19 00:40:55 +00:00
commit f5fc2294a6
52 changed files with 125 additions and 197 deletions

View File

@ -13,7 +13,7 @@ variables:
# https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning # https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning
GIT_DEPTH: 3 GIT_DEPTH: 3
GIT_CLEAN_FLAGS: -f GIT_CLEAN_FLAGS: -f
CACHE_IMAGE_TAG: fb225f5a CACHE_IMAGE_TAG: d2711284
TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/' TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/'
default: default:

66
Cargo.lock generated
View File

@ -45,17 +45,6 @@ version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0453232ace82dee0dd0b4c87a59bd90f7b53b314f3e0f61fe2ee7c8a16482289" checksum = "0453232ace82dee0dd0b4c87a59bd90f7b53b314f3e0f61fe2ee7c8a16482289"
[[package]]
name = "ahash"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
dependencies = [
"getrandom 0.2.12",
"once_cell",
"version_check",
]
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.8.11" version = "0.8.11"
@ -4473,16 +4462,6 @@ dependencies = [
"ttf-parser", "ttf-parser",
] ]
[[package]]
name = "packed_simd"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f9f08af0c877571712e2e3e686ad79efad9657dbf0f7c3c8ba943ff6c38932d"
dependencies = [
"cfg-if 1.0.0",
"num-traits",
]
[[package]] [[package]]
name = "parking" name = "parking"
version = "2.2.0" version = "2.2.0"
@ -5794,8 +5773,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]] [[package]]
name = "shred" name = "shred"
version = "0.15.0" version = "0.16.1"
source = "git+https://github.com/amethyst/shred.git?rev=5d52c6fc390dd04c12158633e77591f6523d1f85#5d52c6fc390dd04c12158633e77591f6523d1f85" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "656294f5bdcf6d33f0cf89e88a72b58595e3fca0e77e4a4b9e9026179757fb1e"
dependencies = [ dependencies = [
"ahash 0.8.11", "ahash 0.8.11",
"arrayvec", "arrayvec",
@ -5808,8 +5788,9 @@ dependencies = [
[[package]] [[package]]
name = "shred-derive" name = "shred-derive"
version = "0.6.3" version = "0.7.0"
source = "git+https://github.com/amethyst/shred.git?rev=5d52c6fc390dd04c12158633e77591f6523d1f85#5d52c6fc390dd04c12158633e77591f6523d1f85" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69760b786f8b40361c10663eb63c81fa7d828008527d26aa7595b99c53ab3a8d"
dependencies = [ dependencies = [
"proc-macro2 1.0.79", "proc-macro2 1.0.79",
"quote 1.0.35", "quote 1.0.35",
@ -5943,10 +5924,9 @@ dependencies = [
[[package]] [[package]]
name = "specs" name = "specs"
version = "0.20.0" version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/amethyst/specs.git?rev=4e2da1df29ee840baa9b936593c45592b7c9ae27#4e2da1df29ee840baa9b936593c45592b7c9ae27"
checksum = "a60eabdfd5a80e458c3e7bcc9f1076d6ce3cc8ddb71d69691f00fc0de735a635"
dependencies = [ dependencies = [
"ahash 0.7.8", "ahash 0.8.11",
"crossbeam-queue", "crossbeam-queue",
"hibitset", "hibitset",
"log", "log",
@ -5962,8 +5942,7 @@ dependencies = [
[[package]] [[package]]
name = "specs-derive" name = "specs-derive"
version = "0.4.1" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/amethyst/specs.git?rev=4e2da1df29ee840baa9b936593c45592b7c9ae27#4e2da1df29ee840baa9b936593c45592b7c9ae27"
checksum = "3e23e09360f3d2190fec4222cd9e19d3158d5da948c0d1ea362df617dd103511"
dependencies = [ dependencies = [
"proc-macro2 1.0.79", "proc-macro2 1.0.79",
"quote 1.0.35", "quote 1.0.35",
@ -6816,9 +6795,9 @@ dependencies = [
[[package]] [[package]]
name = "vek" name = "vek"
version = "0.16.1" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c85158043f3bc1fac596d59a77e07948da340b9951b451ed4cb4a8c480aa2157" checksum = "cb40015035f83ba23d647e647f8be060d0f6f99b7c7687989fbca3e3d65e7234"
dependencies = [ dependencies = [
"approx 0.5.1", "approx 0.5.1",
"num-integer", "num-integer",
@ -6848,7 +6827,7 @@ dependencies = [
"specs", "specs",
"tokio", "tokio",
"tracing", "tracing",
"vek 0.16.1", "vek 0.17.0",
"veloren-client-i18n", "veloren-client-i18n",
"veloren-common", "veloren-common",
"veloren-common-base", "veloren-common-base",
@ -6919,7 +6898,7 @@ dependencies = [
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
"uuid", "uuid",
"vek 0.16.1", "vek 0.17.0",
"veloren-common-assets", "veloren-common-assets",
"veloren-common-base", "veloren-common-base",
"veloren-common-i18n", "veloren-common-i18n",
@ -7004,7 +6983,7 @@ dependencies = [
"specs", "specs",
"sum_type", "sum_type",
"tracing", "tracing",
"vek 0.16.1", "vek 0.17.0",
"veloren-common", "veloren-common",
] ]
@ -7028,7 +7007,7 @@ dependencies = [
"timer-queue", "timer-queue",
"toml 0.8.12", "toml 0.8.12",
"tracing", "tracing",
"vek 0.16.1", "vek 0.17.0",
"veloren-common", "veloren-common",
"veloren-common-assets", "veloren-common-assets",
"veloren-common-base", "veloren-common-base",
@ -7048,7 +7027,7 @@ dependencies = [
"rayon", "rayon",
"specs", "specs",
"tracing", "tracing",
"vek 0.16.1", "vek 0.17.0",
"veloren-common", "veloren-common",
"veloren-common-base", "veloren-common-base",
"veloren-common-ecs", "veloren-common-ecs",
@ -7132,7 +7111,7 @@ dependencies = [
"serde", "serde",
"slotmap", "slotmap",
"tracing", "tracing",
"vek 0.16.1", "vek 0.17.0",
"veloren-common", "veloren-common",
"veloren-world", "veloren-world",
] ]
@ -7175,7 +7154,7 @@ dependencies = [
"strum 0.24.1", "strum 0.24.1",
"tokio", "tokio",
"tracing", "tracing",
"vek 0.16.1", "vek 0.17.0",
"veloren-common", "veloren-common",
"veloren-common-base", "veloren-common-base",
"veloren-common-ecs", "veloren-common-ecs",
@ -7198,7 +7177,7 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"specs", "specs",
"tracing", "tracing",
"vek 0.16.1", "vek 0.17.0",
"veloren-common", "veloren-common",
"veloren-common-base", "veloren-common-base",
"veloren-common-dynlib", "veloren-common-dynlib",
@ -7296,7 +7275,7 @@ dependencies = [
"tokio", "tokio",
"tracing", "tracing",
"treeculler", "treeculler",
"vek 0.16.1", "vek 0.17.0",
"veloren-client", "veloren-client",
"veloren-client-i18n", "veloren-client-i18n",
"veloren-common", "veloren-common",
@ -7324,7 +7303,7 @@ version = "0.10.0"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"lazy_static", "lazy_static",
"vek 0.16.1", "vek 0.17.0",
"veloren-common", "veloren-common",
"veloren-common-dynlib", "veloren-common-dynlib",
] ]
@ -7380,7 +7359,6 @@ dependencies = [
"num 0.4.1", "num 0.4.1",
"num-traits", "num-traits",
"ordered-float 3.9.2", "ordered-float 3.9.2",
"packed_simd",
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
"rayon", "rayon",
@ -7393,7 +7371,7 @@ dependencies = [
"svg_fmt", "svg_fmt",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
"vek 0.16.1", "vek 0.17.0",
"veloren-common", "veloren-common",
"veloren-common-base", "veloren-common-base",
"veloren-common-dynlib", "veloren-common-dynlib",

View File

@ -1,5 +1,3 @@
cargo-features = ["named-profiles", "profile-overrides"]
[workspace] [workspace]
resolver = "2" resolver = "2"
members = [ members = [
@ -147,7 +145,7 @@ crossbeam-channel = { version = "0.5" }
ordered-float = { version = "3", default-features = true } ordered-float = { version = "3", default-features = true }
num = { version = "0.4" } num = { version = "0.4" }
num-traits = { version = "0.2" } num-traits = { version = "0.2" }
vek = { version = "0.16.1", features = ["serde"] } vek = { version = "0.17.0", features = ["serde"] }
itertools = { version = "0.10" } itertools = { version = "0.10" }
serde = { version = "1.0.118", features = ["derive"] } serde = { version = "1.0.118", features = ["derive"] }
@ -164,7 +162,8 @@ sha2 = "0.10"
hex = "0.4.3" hex = "0.4.3"
[patch.crates-io] [patch.crates-io]
shred = { git = "https://github.com/amethyst/shred.git", rev = "5d52c6fc390dd04c12158633e77591f6523d1f85" } # until next specs release
specs = { git = "https://github.com/amethyst/specs.git", rev = "4e2da1df29ee840baa9b936593c45592b7c9ae27" }
# This is needed because of: # This is needed because of:
# * an issue with spirv & naga in wgpu 0.18 (I assume this is fixed upstream but not in 0.18) # * an issue with spirv & naga in wgpu 0.18 (I assume this is fixed upstream but not in 0.18)
# * an issue with uint in uniforms for gl. (potentially fixed in 0.19?) # * an issue with uint in uniforms for gl. (potentially fixed in 0.19?)

View File

@ -45,6 +45,7 @@ pub enum ResourceErr {
#[allow(dead_code)] // false-positive #[allow(dead_code)] // false-positive
err: String, err: String,
}, },
#[allow(dead_code)] // false-positive
BundleError(String), BundleError(String),
} }

View File

@ -1987,9 +1987,9 @@ impl Client {
self.state.terrain().get_key_arc(chunk_pos).cloned() self.state.terrain().get_key_arc(chunk_pos).cloned()
} }
pub fn current<C: Component>(&self) -> Option<C> pub fn current<C>(&self) -> Option<C>
where where
C: Clone, C: Component + Clone,
{ {
self.state.read_storage::<C>().get(self.entity()).cloned() self.state.read_storage::<C>().get(self.entity()).cloned()
} }

View File

@ -168,7 +168,7 @@ impl<P: CompPacket> CompSyncPackage<P> {
.push((uid.into(), CompUpdateKind::Removed(PhantomData::<C>.into()))); .push((uid.into(), CompUpdateKind::Removed(PhantomData::<C>.into())));
} }
pub fn add_component_updates<'a, C: Component + Clone + Send + Sync>( pub fn add_component_updates<'a, C>(
&mut self, &mut self,
uids: &ReadStorage<'a, Uid>, uids: &ReadStorage<'a, Uid>,
tracker: &UpdateTracker<C>, tracker: &UpdateTracker<C>,
@ -176,7 +176,7 @@ impl<P: CompPacket> CompSyncPackage<P> {
filter: impl Join + Copy, filter: impl Join + Copy,
) where ) where
P: From<C>, P: From<C>,
C: TryFrom<P>, C: Component + Clone + Send + Sync + TryFrom<P>,
P::Phantom: From<PhantomData<C>>, P::Phantom: From<PhantomData<C>>,
P::Phantom: TryInto<PhantomData<C>>, P::Phantom: TryInto<PhantomData<C>>,
C::Storage: specs::storage::Tracked, C::Storage: specs::storage::Tracked,
@ -186,7 +186,7 @@ impl<P: CompPacket> CompSyncPackage<P> {
/// If there was an update to the component `C` on the provided entity this /// If there was an update to the component `C` on the provided entity this
/// will add the update to this package. /// will add the update to this package.
pub fn add_component_update<C: Component + Clone + Send + Sync>( pub fn add_component_update<C>(
&mut self, &mut self,
tracker: &UpdateTracker<C>, tracker: &UpdateTracker<C>,
storage: &ReadStorage<'_, C>, storage: &ReadStorage<'_, C>,
@ -194,7 +194,7 @@ impl<P: CompPacket> CompSyncPackage<P> {
entity: Entity, entity: Entity,
) where ) where
P: From<C>, P: From<C>,
C: TryFrom<P>, C: Component + Clone + Send + Sync + TryFrom<P>,
P::Phantom: From<PhantomData<C>>, P::Phantom: From<PhantomData<C>>,
P::Phantom: TryInto<PhantomData<C>>, P::Phantom: TryInto<PhantomData<C>>,
C::Storage: specs::storage::Tracked, C::Storage: specs::storage::Tracked,

View File

@ -1,3 +1,4 @@
#![allow(non_local_definitions)] // necessary because of the Protocol derive macro
use protocol::Protocol; use protocol::Protocol;
pub(crate) const VERSION: u16 = 0; pub(crate) const VERSION: u16 = 0;

View File

@ -24,6 +24,7 @@ impl core::str::FromStr for AdminRole {
} }
} }
#[allow(clippy::to_string_trait_impl)]
impl ToString for AdminRole { impl ToString for AdminRole {
fn to_string(&self) -> String { fn to_string(&self) -> String {
match self { match self {

View File

@ -139,12 +139,10 @@ impl Body {
)) ))
.unwrap_or_default(), .unwrap_or_default(),
), ),
Body::Armor(kind) => match kind {
ItemDropArmorKind::Neck | ItemDropArmorKind::Back | ItemDropArmorKind::Tabard => { Body::Armor(
default.yawed_left(random).pitched_down(PI / 2.0) ItemDropArmorKind::Neck | ItemDropArmorKind::Back | ItemDropArmorKind::Tabard,
}, ) => default.yawed_left(random).pitched_down(PI / 2.0),
_ => default.yawed_left(random),
},
_ => default.yawed_left(random), _ => default.yawed_left(random),
} }
} }

View File

@ -578,7 +578,7 @@ impl Serialize for ItemBase {
// Custom serialization for ItemDef, we only want to send the item_definition_id // Custom serialization for ItemDef, we only want to send the item_definition_id
// over the network, the client will use deserialize_item_def to fetch the // over the network, the client will use deserialize_item_def to fetch the
// ItemDef from assets. // ItemDef from assets.
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,
{ {

View File

@ -87,6 +87,7 @@ pub enum AliasError {
TooLong, TooLong,
} }
#[allow(clippy::to_string_trait_impl)]
impl ToString for AliasError { impl ToString for AliasError {
fn to_string(&self) -> String { fn to_string(&self) -> String {
match *self { match *self {

View File

@ -482,14 +482,14 @@ impl SkillSet {
/// ///
/// NOTE: Please don't use pathological or clever implementations of to_mut /// NOTE: Please don't use pathological or clever implementations of to_mut
/// here. /// here.
pub fn unlock_skill_cow<'a, B, C: 'a>( pub fn unlock_skill_cow<'a, B, C>(
this_: &'a mut B, this_: &'a mut B,
skill: Skill, skill: Skill,
to_mut: impl FnOnce(&'a mut B) -> &'a mut C, to_mut: impl FnOnce(&'a mut B) -> &'a mut C,
) -> Result<(), SkillUnlockError> ) -> Result<(), SkillUnlockError>
where where
B: Borrow<SkillSet>, B: Borrow<SkillSet>,
C: BorrowMut<SkillSet>, C: BorrowMut<SkillSet> + 'a,
{ {
if let Some(skill_group_kind) = skill.skill_group_kind() { if let Some(skill_group_kind) = skill.skill_group_kind() {
let this = (*this_).borrow(); let this = (*this_).borrow();

View File

@ -101,20 +101,14 @@ impl CharacterBehavior for Data {
timer: tick_attack_or_default(data, self.timer, None), timer: tick_attack_or_default(data, self.timer, None),
..*self ..*self
}); });
if let Body::Object(object) = data.body { if matches!(data.body, Body::Object(Flamethrower | Lavathrower)) {
match object { // Send local event used for frontend shenanigans
&Flamethrower | &Lavathrower => { output_events.emit_local(LocalEvent::CreateOutcome(
// Send local event used for frontend shenanigans Outcome::FlamethrowerCharge {
output_events.emit_local(LocalEvent::CreateOutcome( pos: data.pos.0 + *data.ori.look_dir() * (data.body.max_radius()),
Outcome::FlamethrowerCharge {
pos: data.pos.0
+ *data.ori.look_dir() * (data.body.max_radius()),
},
));
}, },
_ => {}, ));
} }
};
} else { } else {
let attack = { let attack = {
let energy = AttackEffect::new( let energy = AttackEffect::new(

View File

@ -32,7 +32,6 @@ pub struct StaticData {
pub vertical_leap_strength: f32, pub vertical_leap_strength: f32,
/// What key is used to press ability /// What key is used to press ability
pub ability_info: AbilityInfo, pub ability_info: AbilityInfo,
///
pub damage_effect: Option<CombatEffect>, pub damage_effect: Option<CombatEffect>,
} }

View File

@ -84,9 +84,6 @@ impl<Context, Target> SynthTyped<Context, Target> for WeakHead<Pure<Target>, Tar
/// [make_case_elim!], as follows: /// [make_case_elim!], as follows:
/// ///
/// ``` /// ```
/// # #![feature(arbitrary_enum_discriminant)]
/// # #[macro_use] extern crate veloren_common;
///
/// veloren_common::make_case_elim!( /// veloren_common::make_case_elim!(
/// my_type_module, /// my_type_module,
/// #[repr(u32)] /// #[repr(u32)]
@ -97,6 +94,10 @@ impl<Context, Target> SynthTyped<Context, Target> for WeakHead<Pure<Target>, Tar
/// /* ..., */ /// /* ..., */
/// } /// }
/// ); /// );
///
/// # fn main() {
/// # println!("some_dummy_main");
/// # }
/// ``` /// ```
/// ///
/// This macro automatically does a few things. First, it creates the `enum` /// This macro automatically does a few things. First, it creates the `enum`
@ -105,9 +106,6 @@ impl<Context, Target> SynthTyped<Context, Target> for WeakHead<Pure<Target>, Tar
/// few things. In this case: /// few things. In this case:
/// ///
/// ``` /// ```
/// # #![feature(arbitrary_enum_discriminant)]
/// # #[macro_use] extern crate veloren_common;
///
/// #[repr(u32)] /// #[repr(u32)]
/// #[derive(Clone, Copy)] /// #[derive(Clone, Copy)]
/// pub enum MyType { /// pub enum MyType {

View File

@ -3,7 +3,7 @@ use core::hash::Hash;
use hashbrown::HashMap; use hashbrown::HashMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use specs::{Component, Entity, FlaggedStorage, VecStorage}; use specs::{Component, Entity, FlaggedStorage, VecStorage};
use std::{fmt, u64}; use std::fmt;
use tracing::error; use tracing::error;
// TODO: could we switch this to `NonZeroU64`? // TODO: could we switch this to `NonZeroU64`?

View File

@ -1,4 +1,4 @@
#![feature(async_closure, exclusive_range_pattern)] #![feature(async_closure)]
//!run with //!run with
//! (cd network/examples/fileshare && RUST_BACKTRACE=1 cargo run //! (cd network/examples/fileshare && RUST_BACKTRACE=1 cargo run
//! --profile=release -Z unstable-options -- --trace=info --port 15006) //! --profile=release -Z unstable-options -- --trace=info --port 15006)

View File

@ -123,7 +123,7 @@ impl Shared {
async fn connect_manager(&self, network: Network) { async fn connect_manager(&self, network: Network) {
trace!("Start connect_manager"); trace!("Start connect_manager");
let iter = futures_util::stream::unfold(network, async move |mut network| { let iter = futures_util::stream::unfold(network, async move |mut network: Network| {
network.connected().await.ok().map(|v| (v, network)) network.connected().await.ok().map(|v| (v, network))
}); });

View File

@ -7,7 +7,8 @@
binary_heap_drain_sorted, binary_heap_drain_sorted,
fn_traits, fn_traits,
unboxed_closures, unboxed_closures,
tuple_trait tuple_trait,
trait_upcasting
)] )]
pub mod ai; pub mod ai;

View File

@ -1 +1 @@
nightly-2024-01-17 nightly-2024-05-14

View File

@ -1,4 +1,4 @@
#![feature(exclusive_range_pattern, let_chains)] #![feature(let_chains)]
#![allow( #![allow(
clippy::needless_pass_by_ref_mut //until we find a better way for specs clippy::needless_pass_by_ref_mut //until we find a better way for specs
)] )]

View File

@ -115,7 +115,6 @@ use specs::{
shred::SendDispatcher, Builder, Entity as EcsEntity, Entity, Join, LendJoin, WorldExt, shred::SendDispatcher, Builder, Entity as EcsEntity, Entity, Join, LendJoin, WorldExt,
}; };
use std::{ use std::{
i32,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
sync::{Arc, Mutex}, sync::{Arc, Mutex},
time::{Duration, Instant}, time::{Duration, Instant},

View File

@ -263,7 +263,7 @@ impl CharacterUpdater {
} }
pub fn has_pending_database_action(&self, character_id: CharacterId) -> bool { pub fn has_pending_database_action(&self, character_id: CharacterId) -> bool {
self.pending_database_actions.get(&character_id).is_some() self.pending_database_actions.contains_key(&character_id)
} }
pub fn process_batch_completion(&mut self, completed_batch_id: u64) { pub fn process_batch_completion(&mut self, completed_batch_id: u64) {

View File

@ -146,6 +146,7 @@ impl core::str::FromStr for SqlLogMode {
} }
} }
#[allow(clippy::to_string_trait_impl)]
impl ToString for SqlLogMode { impl ToString for SqlLogMode {
fn to_string(&self) -> String { fn to_string(&self) -> String {
match self { match self {

View File

@ -1,5 +1,6 @@
pub struct Character { pub struct Character {
pub character_id: i64, pub character_id: i64,
#[allow(dead_code)]
pub player_uuid: String, pub player_uuid: String,
pub alias: String, pub alias: String,
pub waypoint: Option<String>, pub waypoint: Option<String>,
@ -16,6 +17,7 @@ pub struct Item {
} }
pub struct Body { pub struct Body {
#[allow(dead_code)]
pub body_id: i64, pub body_id: i64,
pub variant: String, pub variant: String,
pub body_data: String, pub body_data: String,
@ -38,6 +40,7 @@ pub struct Pet {
} }
pub struct AbilitySets { pub struct AbilitySets {
#[allow(dead_code)]
pub entity_id: i64, pub entity_id: i64,
pub ability_sets: String, pub ability_sets: String,
} }

View File

@ -7,6 +7,7 @@ use std::path::PathBuf;
// See best practices for attribution: https://wiki.creativecommons.org/wiki/Best_practices_for_attribution // See best practices for attribution: https://wiki.creativecommons.org/wiki/Best_practices_for_attribution
#[allow(dead_code)]
#[derive(Clone, Deserialize)] #[derive(Clone, Deserialize)]
pub struct Art { pub struct Art {
/// Name of the art. /// Name of the art.

View File

@ -92,14 +92,13 @@ impl<'a> System<'a> for Sys {
fn base_ori_interp(body: &Body) -> f32 { fn base_ori_interp(body: &Body) -> f32 {
match body { match body {
Body::Object(object) => match object { Body::Object(
object::Body::Crossbow object::Body::Crossbow
| object::Body::Flamethrower | object::Body::Flamethrower
| object::Body::Lavathrower | object::Body::Lavathrower
| object::Body::HaniwaSentry | object::Body::HaniwaSentry
| object::Body::TerracottaStatue => 100.0, | object::Body::TerracottaStatue,
_ => 10.0, ) => 100.0,
},
_ => 10.0, _ => 10.0,
} }
} }

View File

@ -318,7 +318,7 @@ impl<'a> Widget for Chat<'a> {
} }
if let Some(comps) = &self.force_completions { if let Some(comps) = &self.force_completions {
state.update(|s| s.completions = comps.clone()); state.update(|s| s.completions.clone_from(comps));
} }
let mut force_cursor = self.force_cursor; let mut force_cursor = self.force_cursor;
@ -394,8 +394,8 @@ impl<'a> Widget for Chat<'a> {
} else if s.history_pos > 0 { } else if s.history_pos > 0 {
s.history_pos -= 1; s.history_pos -= 1;
} }
if s.history_pos > 0 { if let Some(before) = s.history.iter().nth_back(s.history.len() - s.history_pos) {
s.input.message = s.history.get(s.history_pos - 1).unwrap().to_owned(); s.input.message.clone_from(before);
force_cursor = cursor_offset_to_index( force_cursor = cursor_offset_to_index(
s.input.message.len(), s.input.message.len(),
&s.input.message, &s.input.message,

View File

@ -1,3 +1,4 @@
#![allow(non_local_definitions)] // because of WidgetCommon derive
mod animation; mod animation;
mod bag; mod bag;
mod buffs; mod buffs;

View File

@ -746,7 +746,7 @@ impl<'a> Trade<'a> {
.set(state.ids.amount_input, ui) .set(state.ids.amount_input, ui)
{ {
if new_input != key.input { if new_input != key.input {
key.input = new_input.trim().to_owned(); new_input.trim().clone_into(&mut key.input);
if !key.input.is_empty() { if !key.input.is_empty() {
// trade amount can change with (shift||ctrl)-click // trade amount can change with (shift||ctrl)-click
let amount = *trade.offers[key.who].get(&key.slot).unwrap_or(&0); let amount = *trade.offers[key.who].get(&key.slot).unwrap_or(&0);

View File

@ -182,7 +182,7 @@ fn main() {
?selected_language, ?selected_language,
"Impossible to load language: change to the default language (English) instead.", "Impossible to load language: change to the default language (English) instead.",
); );
settings.language.selected_language = i18n::REFERENCE_LANG.to_owned(); i18n::REFERENCE_LANG.clone_into(&mut settings.language.selected_language);
LocalizationHandle::load_expect(&settings.language.selected_language) LocalizationHandle::load_expect(&settings.language.selected_language)
}); });
i18n.set_english_fallback(settings.language.use_english_fallback); i18n.set_english_fallback(settings.language.use_english_fallback);

View File

@ -376,8 +376,8 @@ impl PlayState for MainMenuState {
let use_srv = net_settings.use_srv; let use_srv = net_settings.use_srv;
let use_quic = net_settings.use_quic; let use_quic = net_settings.use_quic;
let validate_tls = net_settings.validate_tls; let validate_tls = net_settings.validate_tls;
net_settings.username = username.clone(); net_settings.username.clone_from(&username);
net_settings.default_server = server_address.clone(); net_settings.default_server.clone_from(&server_address);
if !net_settings.servers.contains(&server_address) { if !net_settings.servers.contains(&server_address) {
net_settings.servers.push(server_address.clone()); net_settings.servers.push(server_address.clone());
} }

View File

@ -549,7 +549,7 @@ impl Controls {
}, },
Message::ServerChanged(new_value) => { Message::ServerChanged(new_value) => {
self.selected_server_index = Some(new_value); self.selected_server_index = Some(new_value);
self.login_info.server = servers[new_value].clone(); self.login_info.server.clone_from(&servers[new_value]);
}, },
Message::FocusPassword => { Message::FocusPassword => {
if let Screen::Login { screen, .. } = &mut self.screen { if let Screen::Login { screen, .. } = &mut self.screen {

View File

@ -18,7 +18,7 @@ use vek::*;
// /// NOTE: bone_idx must be in [0, 15] (may be bumped to [0, 31] at some // /// NOTE: bone_idx must be in [0, 15] (may be bumped to [0, 31] at some
// /// point). // /// point).
// TODO: this function name... // TODO: this function name...
pub fn generate_mesh_base_vol_figure<'a: 'b, 'b, V: 'a>( pub fn generate_mesh_base_vol_figure<'a: 'b, 'b, V>(
vol: V, vol: V,
(greedy, opaque_mesh, offs, scale, bone_idx): ( (greedy, opaque_mesh, offs, scale, bone_idx): (
&'b mut GreedyMesh<'a, FigureSpriteAtlasData>, &'b mut GreedyMesh<'a, FigureSpriteAtlasData>,
@ -29,7 +29,7 @@ pub fn generate_mesh_base_vol_figure<'a: 'b, 'b, V: 'a>(
), ),
) -> MeshGen<TerrainVertex, TerrainVertex, TerrainVertex, math::Aabb<f32>> ) -> MeshGen<TerrainVertex, TerrainVertex, TerrainVertex, math::Aabb<f32>>
where where
V: BaseVol<Vox = Cell> + ReadVol + SizedVol, V: BaseVol<Vox = Cell> + ReadVol + SizedVol + 'a,
{ {
assert!(bone_idx <= 15, "Bone index for figures must be in [0, 15]"); assert!(bone_idx <= 15, "Bone index for figures must be in [0, 15]");
let max_size = greedy.max_size(); let max_size = greedy.max_size();
@ -115,7 +115,7 @@ where
// /// NOTE: bone_idx must be in [0, 15] (may be bumped to [0, 31] at some // /// NOTE: bone_idx must be in [0, 15] (may be bumped to [0, 31] at some
// /// point). // /// point).
// TODO: this function name... // TODO: this function name...
pub fn generate_mesh_base_vol_terrain<'a: 'b, 'b, V: 'a>( pub fn generate_mesh_base_vol_terrain<'a: 'b, 'b, V>(
vol: V, vol: V,
(greedy, opaque_mesh, offs, scale, bone_idx): ( (greedy, opaque_mesh, offs, scale, bone_idx): (
&'b mut GreedyMesh<'a, FigureSpriteAtlasData>, &'b mut GreedyMesh<'a, FigureSpriteAtlasData>,
@ -126,7 +126,7 @@ pub fn generate_mesh_base_vol_terrain<'a: 'b, 'b, V: 'a>(
), ),
) -> MeshGen<TerrainVertex, TerrainVertex, TerrainVertex, math::Aabb<f32>> ) -> MeshGen<TerrainVertex, TerrainVertex, TerrainVertex, math::Aabb<f32>>
where where
V: BaseVol<Vox = Block> + ReadVol + SizedVol, V: BaseVol<Vox = Block> + ReadVol + SizedVol + 'a,
{ {
assert!(bone_idx <= 15, "Bone index for figures must be in [0, 15]"); assert!(bone_idx <= 15, "Bone index for figures must be in [0, 15]");
let max_size = greedy.max_size(); let max_size = greedy.max_size();
@ -218,7 +218,7 @@ where
(Mesh::new(), Mesh::new(), Mesh::new(), bounds) (Mesh::new(), Mesh::new(), Mesh::new(), bounds)
} }
pub fn generate_mesh_base_vol_sprite<'a: 'b, 'b, V: 'a>( pub fn generate_mesh_base_vol_sprite<'a: 'b, 'b, V>(
vol: V, vol: V,
(greedy, opaque_mesh, vertical_stripes): ( (greedy, opaque_mesh, vertical_stripes): (
&'b mut GreedyMesh<'a, FigureSpriteAtlasData, greedy::SpriteAtlasAllocator>, &'b mut GreedyMesh<'a, FigureSpriteAtlasData, greedy::SpriteAtlasAllocator>,
@ -228,7 +228,7 @@ pub fn generate_mesh_base_vol_sprite<'a: 'b, 'b, V: 'a>(
offset: Vec3<f32>, offset: Vec3<f32>,
) -> MeshGen<SpriteVertex, SpriteVertex, TerrainVertex, ()> ) -> MeshGen<SpriteVertex, SpriteVertex, TerrainVertex, ()>
where where
V: BaseVol<Vox = Cell> + ReadVol + SizedVol, V: BaseVol<Vox = Cell> + ReadVol + SizedVol + 'a,
{ {
let max_size = greedy.max_size(); let max_size = greedy.max_size();
// NOTE: Required because we steal two bits from the normal in the shadow uint // NOTE: Required because we steal two bits from the normal in the shadow uint
@ -345,12 +345,12 @@ where
(Mesh::new(), Mesh::new(), Mesh::new(), ()) (Mesh::new(), Mesh::new(), Mesh::new(), ())
} }
pub fn generate_mesh_base_vol_particle<'a: 'b, 'b, V: 'a>( pub fn generate_mesh_base_vol_particle<'a: 'b, 'b, V>(
vol: V, vol: V,
greedy: &'b mut GreedyMesh<'a, FigureSpriteAtlasData>, greedy: &'b mut GreedyMesh<'a, FigureSpriteAtlasData>,
) -> MeshGen<ParticleVertex, ParticleVertex, TerrainVertex, ()> ) -> MeshGen<ParticleVertex, ParticleVertex, TerrainVertex, ()>
where where
V: BaseVol<Vox = Cell> + ReadVol + SizedVol, V: BaseVol<Vox = Cell> + ReadVol + SizedVol + 'a,
{ {
let max_size = greedy.max_size(); let max_size = greedy.max_size();
// NOTE: Required because we steal two bits from the normal in the shadow uint // NOTE: Required because we steal two bits from the normal in the shadow uint
@ -437,7 +437,7 @@ fn should_draw_greedy(
let from = flat_get(pos - delta); let from = flat_get(pos - delta);
let to = flat_get(pos); let to = flat_get(pos);
let from_opaque = from.is_filled(); let from_opaque = from.is_filled();
if from_opaque != !to.is_filled() { if from_opaque == to.is_filled() {
None None
} else { } else {
// If going from transparent to opaque, backward facing; otherwise, forward // If going from transparent to opaque, backward facing; otherwise, forward
@ -456,7 +456,7 @@ fn should_draw_greedy_ao(
let from = flat_get(pos - delta); let from = flat_get(pos - delta);
let to = flat_get(pos); let to = flat_get(pos);
let from_opaque = from.is_filled(); let from_opaque = from.is_filled();
if from_opaque != !to.is_filled() { if from_opaque == to.is_filled() {
None None
} else { } else {
let faces_forward = from_opaque; let faces_forward = from_opaque;

View File

@ -11,7 +11,6 @@ pub struct RainOcclusionMapRenderer {
pub terrain_pipeline: rain_occlusion::RainOcclusionPipeline, pub terrain_pipeline: rain_occlusion::RainOcclusionPipeline,
pub figure_pipeline: rain_occlusion::RainOcclusionFigurePipeline, pub figure_pipeline: rain_occlusion::RainOcclusionFigurePipeline,
pub layout: rain_occlusion::RainOcclusionLayout,
} }
pub enum RainOcclusionMap { pub enum RainOcclusionMap {
@ -31,13 +30,10 @@ impl RainOcclusionMap {
if let (Some(terrain_pipeline), Some(figure_pipeline), Some(depth)) = if let (Some(terrain_pipeline), Some(figure_pipeline), Some(depth)) =
(directed, figure, view) (directed, figure, view)
{ {
let layout = rain_occlusion::RainOcclusionLayout::new(device);
Self::Enabled(RainOcclusionMapRenderer { Self::Enabled(RainOcclusionMapRenderer {
depth, depth,
terrain_pipeline, terrain_pipeline,
figure_pipeline, figure_pipeline,
layout,
}) })
} else { } else {
Self::Disabled(Self::create_dummy_tex(device, queue)) Self::Disabled(Self::create_dummy_tex(device, queue))

View File

@ -12,7 +12,6 @@ pub struct ShadowMapRenderer {
pub terrain_directed_pipeline: shadow::ShadowPipeline, pub terrain_directed_pipeline: shadow::ShadowPipeline,
pub figure_directed_pipeline: shadow::ShadowFigurePipeline, pub figure_directed_pipeline: shadow::ShadowFigurePipeline,
pub debug_directed_pipeline: shadow::ShadowDebugPipeline, pub debug_directed_pipeline: shadow::ShadowDebugPipeline,
pub layout: shadow::ShadowLayout,
} }
pub enum ShadowMap { pub enum ShadowMap {
@ -43,8 +42,6 @@ impl ShadowMap {
{ {
let (point_depth, directed_depth) = shadow_views; let (point_depth, directed_depth) = shadow_views;
let layout = shadow::ShadowLayout::new(device);
Self::Enabled(ShadowMapRenderer { Self::Enabled(ShadowMapRenderer {
directed_depth, directed_depth,
point_depth, point_depth,
@ -53,8 +50,6 @@ impl ShadowMap {
terrain_directed_pipeline, terrain_directed_pipeline,
figure_directed_pipeline, figure_directed_pipeline,
debug_directed_pipeline, debug_directed_pipeline,
layout,
}) })
} else { } else {
let (dummy_point, dummy_directed) = Self::create_dummy_shadow_tex(device, queue); let (dummy_point, dummy_directed) = Self::create_dummy_shadow_tex(device, queue);

View File

@ -5665,14 +5665,11 @@ impl ItemDropCentralSpec {
(segment, match item_drop { (segment, match item_drop {
// TODO: apply non-random rotations to items here // TODO: apply non-random rotations to items here
item_drop::Body::Tool(_) => Vec3::new(offset.x - 2.0, offset.y, offset.z), item_drop::Body::Tool(_) => Vec3::new(offset.x - 2.0, offset.y, offset.z),
item_drop::Body::Armor(kind) => match kind { item_drop::Body::Armor(
item_drop::ItemDropArmorKind::Neck item_drop::ItemDropArmorKind::Neck
| item_drop::ItemDropArmorKind::Back | item_drop::ItemDropArmorKind::Back
| item_drop::ItemDropArmorKind::Tabard => { | item_drop::ItemDropArmorKind::Tabard,
Vec3::new(offset.x, offset.y - 2.0, offset.z) ) => Vec3::new(offset.x, offset.y - 2.0, offset.z),
},
_ => offset * Vec3::new(1.0, 1.0, 0.0),
},
_ => offset * Vec3::new(1.0, 1.0, 0.0), _ => offset * Vec3::new(1.0, 1.0, 0.0),
}) })
} else { } else {

View File

@ -241,14 +241,10 @@ impl FigureMgrStates {
} }
} }
fn get_mut<'a, Q: ?Sized>( fn get_mut<'a, Q>(&'a mut self, body: &Body, entity: &Q) -> Option<&'a mut FigureStateMeta>
&'a mut self,
body: &Body,
entity: &Q,
) -> Option<&'a mut FigureStateMeta>
where where
EcsEntity: Borrow<Q>, EcsEntity: Borrow<Q>,
Q: Hash + Eq, Q: Hash + Eq + ?Sized,
{ {
match body { match body {
Body::Humanoid(_) => self Body::Humanoid(_) => self
@ -320,10 +316,10 @@ impl FigureMgrStates {
} }
} }
fn remove<Q: ?Sized>(&mut self, body: &Body, entity: &Q) -> Option<FigureStateMeta> fn remove<Q>(&mut self, body: &Body, entity: &Q) -> Option<FigureStateMeta>
where where
EcsEntity: Borrow<Q>, EcsEntity: Borrow<Q>,
Q: Hash + Eq, Q: Hash + Eq + ?Sized,
{ {
match body { match body {
Body::Humanoid(_) => self.character_states.remove(entity).map(|e| e.meta), Body::Humanoid(_) => self.character_states.remove(entity).map(|e| e.meta),
@ -494,14 +490,14 @@ impl FigureMgrStates {
.count() .count()
} }
fn get_terrain_locals<'a, Q: ?Sized>( fn get_terrain_locals<'a, Q>(
&'a self, &'a self,
body: &Body, body: &Body,
entity: &Q, entity: &Q,
) -> Option<&'a BoundTerrainLocals> ) -> Option<&'a BoundTerrainLocals>
where where
EcsEntity: Borrow<Q>, EcsEntity: Borrow<Q>,
Q: Hash + Eq, Q: Hash + Eq + ?Sized,
{ {
match body { match body {
Body::Ship(body) => { Body::Ship(body) => {

View File

@ -153,22 +153,6 @@ struct MeshWorkerResponse {
blocks_of_interest: BlocksOfInterest, blocks_of_interest: BlocksOfInterest,
} }
/// Conversion of SpriteSpec from a hashmap failed because some sprites were
/// missing.
struct SpritesMissing(Vec<SpriteKind>);
use core::fmt;
impl fmt::Display for SpritesMissing {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(
f,
"Missing entries in the sprite manifest for these sprites: {:?}",
&self.0,
)
}
}
pub fn get_sprite_instances<'a, I: 'a>( pub fn get_sprite_instances<'a, I: 'a>(
lod_levels: &'a mut [I; SPRITE_LOD_LEVELS], lod_levels: &'a mut [I; SPRITE_LOD_LEVELS],
set_instance: impl Fn(&mut I, SpriteInstance, Vec3<i32>), set_instance: impl Fn(&mut I, SpriteInstance, Vec3<i32>),

View File

@ -214,7 +214,7 @@ impl SingleplayerWorlds {
'fail: loop { 'fail: loop {
for world in self.worlds.iter() { for world in self.worlds.iter() {
if world.path.ends_with(&test_name) { if world.path.ends_with(&test_name) {
test_name = name.clone(); test_name.clone_from(&name);
test_name.push('_'); test_name.push('_');
test_name.push_str(&i.to_string()); test_name.push_str(&i.to_string());
i += 1; i += 1;

View File

@ -1,3 +1,4 @@
#![allow(non_local_definitions)] // because of WidgetCommon derive
pub mod ghost_image; pub mod ghost_image;
pub mod image_frame; pub mod image_frame;
pub mod image_slider; pub mod image_slider;

View File

@ -7,7 +7,7 @@ edition = "2021"
[features] [features]
use-dyn-lib = ["common-dynlib"] use-dyn-lib = ["common-dynlib"]
be-dyn-lib = [] be-dyn-lib = []
simd = ["vek/platform_intrinsics", "packed_simd"] simd = ["vek/platform_intrinsics"]
bin_compression = [ bin_compression = [
"lz-fear", "lz-fear",
"deflate", "deflate",
@ -45,7 +45,6 @@ tracing = { workspace = true }
rand = { workspace = true } rand = { workspace = true }
rand_chacha = { workspace = true } rand_chacha = { workspace = true }
arr_macro = "0.2.1" arr_macro = "0.2.1"
packed_simd = { version = "0.3.9", optional = true }
rayon = { workspace = true } rayon = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
ron = { workspace = true } ron = { workspace = true }

View File

@ -23,7 +23,7 @@ use common::{
generation::{ChunkSupplement, EntityInfo}, generation::{ChunkSupplement, EntityInfo},
lottery::Lottery, lottery::Lottery,
terrain::{Block, BlockKind, SpriteKind}, terrain::{Block, BlockKind, SpriteKind},
vol::{BaseVol, ReadVol, RectSizedVol, WriteVol}, vol::{ReadVol, RectSizedVol, WriteVol},
}; };
use hashbrown::HashMap; use hashbrown::HashMap;
use noise::NoiseFn; use noise::NoiseFn;
@ -576,7 +576,7 @@ pub fn apply_caves_supplement<'a>(
dynamic_rng: &mut impl Rng, dynamic_rng: &mut impl Rng,
wpos2d: Vec2<i32>, wpos2d: Vec2<i32>,
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>, mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
vol: &(impl BaseVol<Vox = Block> + RectSizedVol + ReadVol + WriteVol), vol: &(impl RectSizedVol<Vox = Block> + ReadVol + WriteVol),
index: IndexRef, index: IndexRef,
supplement: &mut ChunkSupplement, supplement: &mut ChunkSupplement,
) { ) {

View File

@ -6,7 +6,7 @@ use common::{
resources::TimeOfDay, resources::TimeOfDay,
terrain::{BiomeKind, Block}, terrain::{BiomeKind, Block},
time::DayPeriod, time::DayPeriod,
vol::{BaseVol, ReadVol, RectSizedVol, WriteVol}, vol::{ReadVol, RectSizedVol, WriteVol},
}; };
use rand::prelude::*; use rand::prelude::*;
use serde::Deserialize; use serde::Deserialize;
@ -554,7 +554,7 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
dynamic_rng: &mut R, dynamic_rng: &mut R,
wpos2d: Vec2<i32>, wpos2d: Vec2<i32>,
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>, mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
vol: &(impl BaseVol<Vox = Block> + RectSizedVol + ReadVol + WriteVol), vol: &(impl RectSizedVol<Vox = Block> + ReadVol + WriteVol),
index: IndexRef, index: IndexRef,
chunk: &SimChunk, chunk: &SimChunk,
supplement: &mut ChunkSupplement, supplement: &mut ChunkSupplement,
@ -587,8 +587,7 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
let entity_group = scatter let entity_group = scatter
.iter() .iter()
.enumerate() .filter_map(|(entry, get_density)| {
.filter_map(|(_i, (entry, get_density))| {
let density = get_density(chunk, col_sample) * wildlife_density_modifier; let density = get_density(chunk, col_sample) * wildlife_density_modifier;
(density > 0.0) (density > 0.0)
.then(|| { .then(|| {

View File

@ -8,6 +8,7 @@
#![allow(clippy::branches_sharing_code)] // TODO: evaluate #![allow(clippy::branches_sharing_code)] // TODO: evaluate
#![deny(clippy::clone_on_ref_ptr)] #![deny(clippy::clone_on_ref_ptr)]
#![feature(option_zip, let_chains)] #![feature(option_zip, let_chains)]
#![cfg_attr(feature = "simd", feature(portable_simd))]
mod all; mod all;
mod block; mod block;

View File

@ -13,14 +13,12 @@ use itertools::izip;
use noise::NoiseFn; use noise::NoiseFn;
use num::{Float, Zero}; use num::{Float, Zero};
use ordered_float::NotNan; use ordered_float::NotNan;
#[cfg(feature = "simd")] use packed_simd::m32;
use rayon::prelude::*; use rayon::prelude::*;
use std::{ use std::{
cmp::{Ordering, Reverse}, cmp::{Ordering, Reverse},
collections::BinaryHeap, collections::BinaryHeap,
f32, fmt, mem, fmt, mem,
time::Instant, time::Instant,
u32,
}; };
use vek::*; use vek::*;
@ -608,16 +606,17 @@ fn get_max_slope(
// simd alternative // simd alternative
#[cfg(not(feature = "simd"))] #[cfg(not(feature = "simd"))]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[allow(non_camel_case_types)] struct M32(u32);
struct m32(u32);
#[cfg(not(feature = "simd"))] #[cfg(not(feature = "simd"))]
impl m32 { impl M32 {
#[inline] #[inline]
fn new(x: bool) -> Self { if x { Self(u32::MAX) } else { Self(u32::MIN) } } fn splat(x: bool) -> Self { if x { Self(u32::MAX) } else { Self(u32::MIN) } }
#[inline] #[inline]
fn test(&self) -> bool { self.0 != 0 } fn any(&self) -> bool { self.0 != 0 }
} }
#[cfg(feature = "simd")]
type M32 = std::simd::Mask<i32, 1>;
/// Erode all chunks by amount. /// Erode all chunks by amount.
/// ///
@ -862,7 +861,7 @@ fn erode(
let mid_slope = (30.0 / 360.0 * 2.0 * std::f64::consts::PI).tan(); let mid_slope = (30.0 / 360.0 * 2.0 * std::f64::consts::PI).tan();
type SimdType = f32; type SimdType = f32;
type MaskType = m32; type MaskType = M32;
// Precompute factors for Stream Power Law. // Precompute factors for Stream Power Law.
let czero = <SimdType as Zero>::zero(); let czero = <SimdType as Zero>::zero();
@ -1316,7 +1315,7 @@ fn erode(
let tolp = 1.0e-3; let tolp = 1.0e-3;
let mut errp = 2.0 * tolp; let mut errp = 2.0 * tolp;
let mut rec_heights = [0.0; 8]; let mut rec_heights = [0.0; 8];
let mut mask = [MaskType::new(false); 8]; let mut mask = [MaskType::splat(false); 8];
mrec_downhill(map_size_lg, &mrec, posi).for_each(|(kk, posj)| { mrec_downhill(map_size_lg, &mrec, posi).for_each(|(kk, posj)| {
let posj_stack = mstack_inv[posj]; let posj_stack = mstack_inv[posj];
let h_j = h_stack[posj_stack]; let h_j = h_stack[posj_stack];
@ -1324,7 +1323,7 @@ fn erode(
// + uplift(posj) as f64 // + uplift(posj) as f64
// NOTE: We also considered using old_elev_i > wh[posj] here. // NOTE: We also considered using old_elev_i > wh[posj] here.
if old_elev_i > h_j { if old_elev_i > h_j {
mask[kk] = MaskType::new(true); mask[kk] = MaskType::splat(true);
rec_heights[kk] = h_j as SimdType; rec_heights[kk] = h_j as SimdType;
} }
}); });
@ -1333,7 +1332,7 @@ fn erode(
let mut df = 1.0; let mut df = 1.0;
izip!(&mask, &rec_heights, k_fs_fact, k_df_fact).for_each( izip!(&mask, &rec_heights, k_fs_fact, k_df_fact).for_each(
|(&mask_kk, &rec_heights_kk, &k_fs_fact_kk, &k_df_fact_kk)| { |(&mask_kk, &rec_heights_kk, &k_fs_fact_kk, &k_df_fact_kk)| {
if mask_kk.test() { if mask_kk.any() {
let h_j = rec_heights_kk; let h_j = rec_heights_kk;
let elev_j = h_j; let elev_j = h_j;
let dh = 0.0.max(new_h_i as SimdType - elev_j); let dh = 0.0.max(new_h_i as SimdType - elev_j);

View File

@ -858,8 +858,7 @@ impl WorldSim {
(gen_ctx (gen_ctx
.alt_nz .alt_nz
.get((wposf.div(10_000.0)).into_array()) .get((wposf.div(10_000.0)).into_array())
.min(1.0) .clamp(-1.0, 1.0))
.max(-1.0))
.sub(0.05) .sub(0.05)
.mul(0.35), .mul(0.35),
) )
@ -871,8 +870,7 @@ impl WorldSim {
(gen_ctx (gen_ctx
.alt_nz .alt_nz
.get((wposf.div(5_000.0 * gen_opts.scale)).into_array()) .get((wposf.div(5_000.0 * gen_opts.scale)).into_array())
.min(1.0) .clamp(-1.0, 1.0))
.max(-1.0))
.add( .add(
0.2 - ((wposf / world_sizef) * 2.0 - 1.0) 0.2 - ((wposf / world_sizef) * 2.0 - 1.0)
.magnitude_squared() .magnitude_squared()

View File

@ -7,7 +7,7 @@ use common_base::prof_span;
use noise::{MultiFractal, NoiseFn, Perlin, Seedable}; use noise::{MultiFractal, NoiseFn, Perlin, Seedable};
use num::Float; use num::Float;
use rayon::prelude::*; use rayon::prelude::*;
use std::{f32, f64, ops::Mul, u32}; use std::ops::Mul;
use vek::*; use vek::*;
/// Calculates the smallest distance along an axis (x, y) from an edge of /// Calculates the smallest distance along an axis (x, y) from an edge of

View File

@ -14,7 +14,7 @@ use crate::{
use common::{ use common::{
generation::ChunkSupplement, generation::ChunkSupplement,
terrain::{Block, BlockKind, SpriteKind}, terrain::{Block, BlockKind, SpriteKind},
vol::{BaseVol, ReadVol, RectSizedVol, WriteVol}, vol::{ReadVol, RectSizedVol, WriteVol},
}; };
use core::f32; use core::f32;
use rand::prelude::*; use rand::prelude::*;
@ -190,7 +190,7 @@ impl Castle {
index: IndexRef, index: IndexRef,
wpos2d: Vec2<i32>, wpos2d: Vec2<i32>,
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>, mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
vol: &mut (impl BaseVol<Vox = Block> + RectSizedVol + ReadVol + WriteVol), vol: &mut (impl RectSizedVol<Vox = Block> + ReadVol + WriteVol),
) { ) {
for y in 0..vol.size_xy().y as i32 { for y in 0..vol.size_xy().y as i32 {
for x in 0..vol.size_xy().x as i32 { for x in 0..vol.size_xy().x as i32 {

View File

@ -30,7 +30,7 @@ use common::{
store::{Id, Store}, store::{Id, Store},
terrain::{Block, BlockKind, SpriteKind, TerrainChunkSize}, terrain::{Block, BlockKind, SpriteKind, TerrainChunkSize},
trade::{Good, SiteInformation}, trade::{Good, SiteInformation},
vol::{BaseVol, ReadVol, RectSizedVol, RectVolSize, WriteVol}, vol::{ReadVol, RectSizedVol, RectVolSize, WriteVol},
}; };
use fxhash::FxHasher64; use fxhash::FxHasher64;
@ -560,7 +560,7 @@ impl Settlement {
index: IndexRef, index: IndexRef,
wpos2d: Vec2<i32>, wpos2d: Vec2<i32>,
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>, mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
vol: &mut (impl BaseVol<Vox = Block> + RectSizedVol + ReadVol + WriteVol), vol: &mut (impl RectSizedVol<Vox = Block> + ReadVol + WriteVol),
) { ) {
let colors = &index.colors.site.settlement; let colors = &index.colors.site.settlement;

View File

@ -1415,18 +1415,6 @@ impl<'a, const N: usize> PrimitiveTransform for [PrimitiveRef<'a>; N] {
} }
} }
pub trait PrimitiveGroupFill<const N: usize> {
fn fill_many(self, fills: [Fill; N]);
}
impl<const N: usize> PrimitiveGroupFill<N> for [PrimitiveRef<'_>; N] {
fn fill_many(self, fills: [Fill; N]) {
for i in 0..N {
self[i].fill(fills[i].clone());
}
}
}
pub trait Structure { pub trait Structure {
#[cfg(feature = "use-dyn-lib")] #[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8]; const UPDATE_FN: &'static [u8];