Merge branch 'xMAC/smol-fixes' into 'master'

backporting lints from newer toolchain, activating world in server/agent

See merge request veloren/veloren!4462
This commit is contained in:
Marcel 2024-05-17 08:36:03 +00:00
commit e63b42645f
12 changed files with 189 additions and 127 deletions

3
Cargo.lock generated
View File

@ -6651,7 +6651,7 @@ version = "1.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"rand 0.8.5",
"static_assertions",
]
@ -7203,6 +7203,7 @@ dependencies = [
"veloren-common-base",
"veloren-common-dynlib",
"veloren-rtsim",
"veloren-world",
]
[[package]]

View File

@ -123,7 +123,12 @@ rand_chacha = { version = "0.3" }
bincode = { version = "1.3.3" }
bitflags = { version = "2.2.1" }
slab = { version = "0.4.2" }
chrono = { version = "0.4.24", default-features=false, features = ["clock", "std", "wasmbind", "serde"] }
chrono = { version = "0.4.24", default-features = false, features = [
"clock",
"std",
"wasmbind",
"serde",
] }
chrono-tz = { version = "0.8", features = ["serde"] }
inline_tweak = { version = "1.0.8" }
@ -179,4 +184,3 @@ wgpu = { git = "https://github.com/Imberflur/wgpu.git", tag = "0.18-with-fixes-f
# wgpu-core = { path = "../wgpu/wgpu-core" }
# wgpu-types = { path = "../wgpu/wgpu-types" }
# naga = { path = "../wgpu/naga" }

View File

@ -17,7 +17,7 @@ impl Default for Ori {
impl Ori {
pub fn new(quat: Quaternion<f32>) -> Self {
#[cfg(debug_assert)]
#[cfg(debug_assertions)]
{
let v4 = quat.into_vec4();
debug_assert!(v4.map(f32::is_finite).reduce_and());

View File

@ -5,13 +5,15 @@ use crate::{
};
use common_base::span;
use hashbrown::hash_map::DefaultHashBuilder;
#[cfg(rrt_pathfinding)] use hashbrown::HashMap;
#[cfg(rrt_pathfinding)]
#[cfg(feature = "rrt_pathfinding")]
use hashbrown::HashMap;
#[cfg(feature = "rrt_pathfinding")]
use kiddo::{distance::squared_euclidean, KdTree}; // For RRT paths (disabled for now)
#[cfg(rrt_pathfinding)]
#[cfg(feature = "rrt_pathfinding")]
use rand::distributions::Uniform;
use rand::{thread_rng, Rng};
#[cfg(rrt_pathfinding)] use std::f32::consts::PI;
#[cfg(feature = "rrt_pathfinding")]
use std::f32::consts::PI;
use std::iter::FromIterator;
use vek::*;
@ -705,7 +707,7 @@ where
}
// Enable when airbraking/sensible flight is a thing
#[cfg(rrt_pathfinding)]
#[cfg(feature = "rrt_pathfinding")]
fn find_air_path<V>(
vol: &V,
startf: Vec3<f32>,
@ -757,7 +759,7 @@ where
/// with wider gaps, such as flying through a forest than for terrain
/// with narrow gaps, such as navigating a maze.
/// Returns a path and whether that path is complete or not.
#[cfg(rrt_pathfinding)]
#[cfg(feature = "rrt_pathfinding")]
fn informed_rrt_connect(
start: Vec3<f32>,
end: Vec3<f32>,
@ -983,7 +985,7 @@ fn informed_rrt_connect(
/// along the axis between the foci. The value of the search parameter must be
/// greater than zero. In order to increase the sample area, the
/// search_parameter should be increased linearly as the search continues.
#[cfg(rrt_pathfinding)]
#[cfg(feature = "rrt_pathfinding")]
pub fn point_on_prolate_spheroid(
focus1: Vec3<f32>,
focus2: Vec3<f32>,

View File

@ -766,6 +766,10 @@ impl ComponentRecipe {
}
pub fn inputs(&self) -> impl ExactSizeIterator<Item = (&RecipeInput, u32)> {
self.into_iter().map(|(recipe, amount)| (recipe, *amount))
}
}
pub struct ComponentRecipeInputsIterator<'a> {
material: Option<&'a (RecipeInput, u32)>,
modifier: Option<&'a (RecipeInput, u32)>,
@ -804,10 +808,6 @@ impl ComponentRecipe {
}
}
self.into_iter().map(|(recipe, amount)| (recipe, *amount))
}
}
#[derive(Clone, Deserialize)]
struct RawComponentRecipe {
output: RawComponentOutput,

View File

@ -5,7 +5,7 @@ authors = ["Joshua Barretto <joshua.s.barretto@gmail.com>"]
edition = "2021"
[features]
worldgen = []
worldgen = ["server-agent/worldgen"]
simd = ["vek/platform_intrinsics"]
plugins = ["common-state/plugins"]
persistent_world = []
@ -18,14 +18,20 @@ default = ["worldgen", "plugins", "persistent_world", "simd"]
[dependencies]
common = { package = "veloren-common", path = "../common" }
common-base = { package = "veloren-common-base", path = "../common/base" }
veloren-query-server = { package = "veloren-query-server", path = "../common/query_server", default-features = false, features = ["server"] }
veloren-query-server = { package = "veloren-query-server", path = "../common/query_server", default-features = false, features = [
"server",
] }
common-ecs = { package = "veloren-common-ecs", path = "../common/ecs" }
common-state = { package = "veloren-common-state", path = "../common/state" }
common-systems = { package = "veloren-common-systems", path = "../common/systems" }
common-net = { package = "veloren-common-net", path = "../common/net" }
world = { package = "veloren-world", path = "../world" }
rtsim = { package = "veloren-rtsim", path = "../rtsim" }
network = { package = "veloren-network", path = "../network", features = ["metrics", "compression", "quic"], default-features = false }
network = { package = "veloren-network", path = "../network", features = [
"metrics",
"compression",
"quic",
], default-features = false }
server-agent = { package = "veloren-server-agent", path = "agent" }
@ -65,7 +71,12 @@ enum-map = { workspace = true }
noise = { version = "0.7", default-features = false }
censor = "0.3"
rusqlite = { version = "0.30.0", features = ["array", "vtab", "bundled", "trace"] }
rusqlite = { version = "0.30.0", features = [
"array",
"vtab",
"bundled",
"trace",
] }
refinery = { version = "0.8.12", features = ["rusqlite"] }
schnellru = "0.2.1"

View File

@ -5,6 +5,7 @@ edition = "2021"
version = "0.1.0"
[features]
worldgen = ["world"]
use-dyn-lib = ["common-dynlib"]
be-dyn-lib = []
@ -12,6 +13,7 @@ be-dyn-lib = []
common = { package = "veloren-common", path = "../../common" }
common-base = { package = "veloren-common-base", path = "../../common/base" }
common-dynlib = { package = "veloren-common-dynlib", path = "../../common/dynlib", optional = true }
world = { package = "veloren-world", path = "../../world", optional = true }
rtsim = { package = "veloren-rtsim", path = "../../rtsim" }
specs = { workspace = true, features = ["shred-derive"] }

View File

@ -409,7 +409,7 @@ pub struct ReadData<'a> {
pub time_of_day: Read<'a, TimeOfDay>,
pub light_emitter: ReadStorage<'a, LightEmitter>,
#[cfg(feature = "worldgen")]
pub world: ReadExpect<'a, Arc<world::World>>,
pub world: ReadExpect<'a, std::sync::Arc<world::World>>,
pub rtsim_entities: ReadStorage<'a, RtSimEntity>,
pub buffs: ReadStorage<'a, Buffs>,
pub combos: ReadStorage<'a, Combo>,

View File

@ -1,5 +1,8 @@
[package]
authors = ["Joshua Barretto <joshua.s.barretto@gmail.com>", "Imbris <imbrisf@gmail.com>"]
authors = [
"Joshua Barretto <joshua.s.barretto@gmail.com>",
"Imbris <imbrisf@gmail.com>",
]
default-run = "veloren-voxygen"
edition = "2021"
name = "veloren-voxygen"
@ -34,7 +37,13 @@ discord = ["discord-sdk"]
bin_img-export = ["common-assets"]
# We don't ship egui with published release builds so a separate feature is required that excludes it.
default-publish = ["singleplayer", "native-dialog", "plugins", "discord", "simd"]
default-publish = [
"singleplayer",
"native-dialog",
"plugins",
"discord",
"simd",
]
# Temp for bug on current wgpu version that has access violation in vulkan when constructing egui pipeline
default-no-egui = ["default-publish", "hot-reloading", "shaderc-from-source"]
default = ["default-no-egui", "egui-ui"]
@ -57,7 +66,11 @@ voxygen-egui = {package = "veloren-voxygen-egui", path = "egui", optional = true
# Graphics
winit = { version = "0.28.6", features = ["serde"] }
wgpu = { version = "0.18.0", default-features = false, features = ["trace", "spirv", "glsl"] }
wgpu = { version = "0.18.0", default-features = false, features = [
"trace",
"spirv",
"glsl",
] }
wgpu-profiler = "0.15.0"
bytemuck = { version = "1.7", features = ["derive"] }
# shaderc = "0.8.0"
@ -92,7 +105,9 @@ levenshtein = "1.0.5"
gilrs = { version = "0.10.0", features = ["serde-serialize"] }
# Singleplayer
server = { package = "veloren-server", path = "../server", optional = true, default-features = false, features = ["worldgen"] }
server = { package = "veloren-server", path = "../server", optional = true, default-features = false, features = [
"worldgen",
] }
# CLI
clap = { workspace = true }
@ -137,10 +152,10 @@ enum-map = { workspace = true }
[target.'cfg(target_os = "macos")'.dependencies]
dispatch = "0.1.4"
[target.'cfg(windows)'.build-dependencies]
[target.'cfg(target_family = "windows")'.build-dependencies]
winres = "0.1"
[target.'cfg(windows)'.dependencies]
[target.'cfg(target_family = "windows")'.dependencies]
mimalloc = "0.1.29"
# Mumble
@ -148,7 +163,10 @@ mimalloc = "0.1.29"
mumble-link = "0.2.0"
[dev-dependencies]
criterion = { version = "0.5.1", default-features=false, features=["rayon", "cargo_bench_support"]}
criterion = { version = "0.5.1", default-features = false, features = [
"rayon",
"cargo_bench_support",
] }
world = { package = "veloren-world", path = "../world" }
rayon = { workspace = true }

View File

@ -203,6 +203,22 @@ fn get_site_economy(site_rich: &SiteInfoRich) -> String {
}
}
impl From<KeyMouse> for ConrodMouseButton {
fn from(key: KeyMouse) -> Self {
match key {
KeyMouse::Mouse(MouseButton::Left) => ConrodMouseButton::Left,
KeyMouse::Mouse(MouseButton::Right) => ConrodMouseButton::Right,
KeyMouse::Mouse(MouseButton::Middle) => ConrodMouseButton::Middle,
KeyMouse::Mouse(MouseButton::Other(0)) => ConrodMouseButton::X1,
KeyMouse::Mouse(MouseButton::Other(1)) => ConrodMouseButton::X2,
KeyMouse::Mouse(MouseButton::Other(2)) => ConrodMouseButton::Button6,
KeyMouse::Mouse(MouseButton::Other(3)) => ConrodMouseButton::Button7,
KeyMouse::Mouse(MouseButton::Other(4)) => ConrodMouseButton::Button8,
_ => conrod_core::input::MouseButton::Unknown,
}
}
}
impl<'a> Widget for Map<'a> {
type Event = Vec<Event>;
type State = State;
@ -353,21 +369,6 @@ impl<'a> Widget for Map<'a> {
let max_drag = player_pos_chunks;
let drag = self.map_drag.clamped(min_drag, max_drag);
impl From<KeyMouse> for ConrodMouseButton {
fn from(key: KeyMouse) -> Self {
match key {
KeyMouse::Mouse(MouseButton::Left) => ConrodMouseButton::Left,
KeyMouse::Mouse(MouseButton::Right) => ConrodMouseButton::Right,
KeyMouse::Mouse(MouseButton::Middle) => ConrodMouseButton::Middle,
KeyMouse::Mouse(MouseButton::Other(0)) => ConrodMouseButton::X1,
KeyMouse::Mouse(MouseButton::Other(1)) => ConrodMouseButton::X2,
KeyMouse::Mouse(MouseButton::Other(2)) => ConrodMouseButton::Button6,
KeyMouse::Mouse(MouseButton::Other(3)) => ConrodMouseButton::Button7,
KeyMouse::Mouse(MouseButton::Other(4)) => ConrodMouseButton::Button8,
_ => conrod_core::input::MouseButton::Unknown,
}
}
}
enum MarkerChange {
Pos(Vec2<f32>),
ClickPos,

View File

@ -244,7 +244,7 @@ impl KeyMouse {
Key(PrevTrack) => "Prev Track",
Key(NextTrack) => "Next Track",
Key(LAlt) => {
if cfg!(macos) {
if cfg!(target_os = "macos") {
"Left Option ⌥"
} else {
// Assume Windows, Linux, BSD, etc.
@ -252,7 +252,7 @@ impl KeyMouse {
}
},
Key(RAlt) => {
if cfg!(macos) {
if cfg!(target_os = "macos") {
"Right Option ⌥"
} else {
// Assume Windows, Linux, BSD, etc.
@ -260,7 +260,7 @@ impl KeyMouse {
}
},
Key(LControl) => {
if cfg!(macos) {
if cfg!(target_os = "macos") {
"Left Cmd ⌘"
} else {
// Assume Windows, Linux, BSD, etc.
@ -268,7 +268,7 @@ impl KeyMouse {
}
},
Key(RControl) => {
if cfg!(macos) {
if cfg!(target_os = "macos") {
"Right Cmd ⌘"
} else {
// Assume Windows, Linux, BSD, etc.
@ -281,9 +281,9 @@ impl KeyMouse {
// qualifier. The exception to this is Mac OS which doesn't usually have
// this key at all, so we keep the qualifier to minimise ambiguity.
Key(LWin) => {
if cfg!(windows) {
if cfg!(target_family = "windows") {
"Win ⊞"
} else if cfg!(macos) {
} else if cfg!(target_os = "macos") {
"Left Cmd ⌘ (Super)" // Extra qualifier because both Ctrl and Win map to Cmd on Mac
} else {
// Assume Linux, BSD, etc.
@ -292,9 +292,9 @@ impl KeyMouse {
},
// Most keyboards don't have this key, so throw in all the qualifiers
Key(RWin) => {
if cfg!(windows) {
if cfg!(target_family = "windows") {
"Right Win ⊞"
} else if cfg!(macos) {
} else if cfg!(target_os = "macos") {
"Right Cmd ⌘ (Super)" // Extra qualifier because both Ctrl and Win map to Cmd on Mac
} else {
// Assume Linux, BSD, etc.
@ -427,7 +427,7 @@ impl Window {
// Avoid cpal / winit OleInitialize conflict
// See: https://github.com/rust-windowing/winit/pull/1524
#[cfg(target_os = "windows")]
#[cfg(target_family = "windows")]
let win_builder = winit::platform::windows::WindowBuilderExtWindows::with_drag_and_drop(
win_builder,
false,

View File

@ -8,7 +8,16 @@ edition = "2021"
use-dyn-lib = ["common-dynlib"]
be-dyn-lib = []
simd = ["vek/platform_intrinsics", "packed_simd"]
bin_compression = ["lz-fear", "deflate", "flate2", "image/jpeg", "num-traits", "fallible-iterator", "rstar", "cli"]
bin_compression = [
"lz-fear",
"deflate",
"flate2",
"image/jpeg",
"num-traits",
"fallible-iterator",
"rstar",
"cli",
]
cli = ["clap", "signal-hook", "indicatif"]
default = ["simd"]
@ -58,11 +67,25 @@ indicatif = { version = "0.17.8", optional = true }
[dev-dependencies]
common-frontend = { package = "veloren-common-frontend", path = "../common/frontend" }
criterion = { version = "0.5.1", default-features=false, features=["rayon", "cargo_bench_support"]}
criterion = { version = "0.5.1", default-features = false, features = [
"rayon",
"cargo_bench_support",
] }
csv = "1.1.3"
tracing-subscriber = { version = "0.3.7", default-features = false, features = ["fmt", "time", "ansi", "smallvec", "env-filter"] }
tracing-subscriber = { version = "0.3.7", default-features = false, features = [
"fmt",
"time",
"ansi",
"smallvec",
"env-filter",
] }
minifb = "0.25"
rusqlite = { version = "0.30.0", features = ["array", "vtab", "bundled", "trace"] }
rusqlite = { version = "0.30.0", features = [
"array",
"vtab",
"bundled",
"trace",
] }
svg_fmt = "0.4"
[[bench]]