mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
remove enum_iterator with strum, fixes #1723
This commit is contained in:
parent
3490600ca0
commit
1e1ee5031f
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -6699,7 +6699,6 @@ dependencies = [
|
||||
"crossbeam-utils 0.8.11",
|
||||
"csv",
|
||||
"dot_vox",
|
||||
"enum-iterator 1.1.3",
|
||||
"fxhash",
|
||||
"hashbrown 0.12.3",
|
||||
"indexmap",
|
||||
|
@ -26,7 +26,6 @@ common-base = { package = "veloren-common-base", path = "base" }
|
||||
serde = { version = "1.0.110", features = ["derive", "rc"] }
|
||||
|
||||
# Util
|
||||
enum-iterator = "1.1.0"
|
||||
vek = { version = "0.15.8", features = ["serde"] }
|
||||
chrono = "0.4.22"
|
||||
chrono-tz = "0.6"
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{comp::tool::ToolKind, lottery::LootSpec, make_case_elim};
|
||||
use enum_iterator::Sequence;
|
||||
use strum::EnumIter;
|
||||
use hashbrown::HashMap;
|
||||
use lazy_static::lazy_static;
|
||||
use num_derive::FromPrimitive;
|
||||
@ -17,7 +17,7 @@ make_case_elim!(
|
||||
PartialEq,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
Sequence,
|
||||
EnumIter,
|
||||
FromPrimitive,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
@ -557,8 +557,10 @@ impl fmt::Display for SpriteKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) }
|
||||
}
|
||||
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref SPRITE_KINDS: HashMap<String, SpriteKind> = enum_iterator::all::<SpriteKind>()
|
||||
pub static ref SPRITE_KINDS: HashMap<String, SpriteKind> = SpriteKind::iter()
|
||||
.map(|sk| (sk.to_string(), sk))
|
||||
.collect();
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ use std::sync::{
|
||||
atomic::{AtomicU64, Ordering},
|
||||
Arc,
|
||||
};
|
||||
use strum::IntoEnumIterator;
|
||||
use tracing::warn;
|
||||
use treeculler::{BVol, Frustum, AABB};
|
||||
use vek::*;
|
||||
@ -195,7 +196,7 @@ impl TryFrom<HashMap<SpriteKind, Option<SpriteConfig<String>>>> for SpriteSpec {
|
||||
mut map: HashMap<SpriteKind, Option<SpriteConfig<String>>>,
|
||||
) -> Result<Self, Self::Error> {
|
||||
let mut array = [(); 256].map(|()| None);
|
||||
let sprites_missing = enum_iterator::all::<SpriteKind>()
|
||||
let sprites_missing = SpriteKind::iter()
|
||||
.filter(|kind| match map.remove(kind) {
|
||||
Some(config) => {
|
||||
array[*kind as usize] = config;
|
||||
@ -453,7 +454,7 @@ impl SpriteRenderContext {
|
||||
);
|
||||
let mut sprite_mesh = Mesh::new();
|
||||
// NOTE: Tracks the start vertex of the next model to be meshed.
|
||||
let sprite_data: HashMap<(SpriteKind, usize), _> = enum_iterator::all::<SpriteKind>()
|
||||
let sprite_data: HashMap<(SpriteKind, usize), _> = SpriteKind::iter()
|
||||
.filter_map(|kind| Some((kind, sprite_config.get(kind)?)))
|
||||
.flat_map(|(kind, sprite_config)| {
|
||||
sprite_config.variations.iter().enumerate().map(
|
||||
|
@ -37,6 +37,7 @@ serde = { version = "1.0.110", features = ["derive"] }
|
||||
ron = { version = "0.8", default-features = false }
|
||||
# inline_tweak = "1.0.2"
|
||||
kiddo = "0.2"
|
||||
strum = "0.24.0"
|
||||
|
||||
# compression benchmarks
|
||||
lz-fear = { version = "0.1.1", optional = true }
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::util::math::close;
|
||||
use enum_iterator::Sequence;
|
||||
use std::ops::Range;
|
||||
use strum::EnumIter;
|
||||
use vek::Vec2;
|
||||
|
||||
#[derive(Copy, Clone, Debug, Sequence)]
|
||||
#[derive(Copy, Clone, Debug, EnumIter)]
|
||||
pub enum ForestKind {
|
||||
Palm,
|
||||
Acacia,
|
||||
|
@ -69,6 +69,7 @@ use std::{
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
};
|
||||
use strum::IntoEnumIterator;
|
||||
use tracing::{debug, warn};
|
||||
use vek::*;
|
||||
|
||||
@ -2238,7 +2239,7 @@ impl WorldSim {
|
||||
};
|
||||
let env = chunk.get_environment();
|
||||
Lottery::from(
|
||||
enum_iterator::all::<ForestKind>()
|
||||
ForestKind::iter()
|
||||
.enumerate()
|
||||
.map(|(i, fk)| {
|
||||
const CLUSTER_SIZE: f64 = 48.0;
|
||||
@ -2551,7 +2552,7 @@ impl SimChunk {
|
||||
},
|
||||
};
|
||||
|
||||
enum_iterator::all::<ForestKind>()
|
||||
ForestKind::iter()
|
||||
.max_by_key(|fk| (fk.proclivity(&env) * 10000.0) as u32)
|
||||
.unwrap() // Can't fail
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user