mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'imbris/update-toolchain' into 'master'
Update toolchain See merge request veloren/veloren!2322
This commit is contained in:
commit
2c279c02d1
@ -13,3 +13,5 @@ test-voxygen = "run --bin veloren-voxygen --no-default-features --features gl,si
|
||||
tracy-voxygen = "-Zunstable-options run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile no_overflow"
|
||||
server = "run --bin veloren-server-cli"
|
||||
|
||||
[env]
|
||||
RUSTC_FORCE_INCREMENTAL = "1"
|
||||
|
@ -13,9 +13,9 @@ variables:
|
||||
# ttps://docs.gitlab.com/ee/ci/yaml/#shallow-cloning
|
||||
GIT_DEPTH: 3
|
||||
GIT_CLEAN_FLAGS: -f
|
||||
CACHE_IMAGE_TAG: 7ea40612
|
||||
|
||||
default:
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache:e134e812
|
||||
# https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines
|
||||
interruptible: true
|
||||
# Retry automatically incase the runner times out or there's a runner failure
|
||||
@ -24,6 +24,8 @@ default:
|
||||
when:
|
||||
- runner_system_failure
|
||||
- stuck_or_timeout_failure
|
||||
tags:
|
||||
- veloren-docker
|
||||
|
||||
before_script:
|
||||
- source $HOME/.cargo/env
|
||||
|
@ -1,10 +1,11 @@
|
||||
unittests:
|
||||
extends: .recompile-branch
|
||||
stage: build
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
||||
variables:
|
||||
GIT_DEPTH: 9999999999999
|
||||
script:
|
||||
- ln -s /dockercache/cache-all target
|
||||
- ln -s /dockercache/target target
|
||||
- rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
- cargo test --package veloren-i18n --lib test_all_localizations -- --nocapture --ignored
|
||||
- rm -r target/debug/incremental* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
@ -15,11 +16,12 @@ unittests:
|
||||
benchmarks:
|
||||
extends: .post-merge
|
||||
stage: build
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/bench:${CACHE_IMAGE_TAG}
|
||||
tags:
|
||||
- veloren-benchmark
|
||||
script:
|
||||
- unset DISABLE_GIT_LFS_CHECK
|
||||
- ln -s /dockercache/cache-all target
|
||||
- ln -s /dockercache/target target
|
||||
- ls -la target/*
|
||||
- rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
- rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
@ -40,8 +42,9 @@ benchmarks:
|
||||
coverage:
|
||||
extends: .post-merge
|
||||
stage: build
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/tarpaulin:${CACHE_IMAGE_TAG}
|
||||
script:
|
||||
- ln -s /dockercache/cache-tarpaulin target
|
||||
- ln -s /dockercache/target target
|
||||
- rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
- find ./* -name "Cargo.toml" -exec sed -i 's/, "simd"]/]/g' {} \;
|
||||
- find ./* -name "Cargo.toml" -exec sed -i 's/"simd"]/]/g' {} \;
|
||||
@ -52,8 +55,9 @@ coverage:
|
||||
|
||||
#linux, windows, macos builds here as template
|
||||
.tlinux:
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/release-linux:${CACHE_IMAGE_TAG}
|
||||
script:
|
||||
- ln -s /dockercache/cache-release-linux target
|
||||
- ln -s /dockercache/target target
|
||||
- rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
- VELOREN_USERDATA_STRATEGY=executable cargo build --release
|
||||
- cp -r target/release/veloren-server-cli $CI_PROJECT_DIR
|
||||
@ -67,8 +71,9 @@ coverage:
|
||||
expire_in: 1 week
|
||||
|
||||
.twindows:
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/release-windows:${CACHE_IMAGE_TAG}
|
||||
script:
|
||||
- ln -s /dockercache/cache-release-windows target
|
||||
- ln -s /dockercache/target target
|
||||
- rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
- VELOREN_USERDATA_STRATEGY=executable cargo build --target=x86_64-pc-windows-gnu --release
|
||||
- cp -r target/x86_64-pc-windows-gnu/release/veloren-server-cli.exe $CI_PROJECT_DIR
|
||||
@ -82,10 +87,11 @@ coverage:
|
||||
expire_in: 1 week
|
||||
|
||||
.tmacos:
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/release-macos:${CACHE_IMAGE_TAG}
|
||||
script:
|
||||
- ln -s /dockercache/cache-release-macos target
|
||||
- ln -s /dockercache/target target
|
||||
- rm -r target/release/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
- VELOREN_USERDATA_STRATEGY=executable WINIT_LINK_COLORSYNC=true PATH="/dockercache/osxcross/target/bin:$PATH" COREAUDIO_SDK_PATH=/dockercache/osxcross/target/SDK/MacOSX10.13.sdk CC=o64-clang CXX=o64-clang++ cargo build --target x86_64-apple-darwin --release
|
||||
- VELOREN_USERDATA_STRATEGY=executable WINIT_LINK_COLORSYNC=true PATH="/osxcross/target/bin:$PATH" COREAUDIO_SDK_PATH=/osxcross/target/SDK/MacOSX10.13.sdk CC=o64-clang CXX=o64-clang++ cargo build --target x86_64-apple-darwin --release
|
||||
- cp -r target/x86_64-apple-darwin/release/veloren-server-cli $CI_PROJECT_DIR
|
||||
- cp -r target/x86_64-apple-darwin/release/veloren-voxygen $CI_PROJECT_DIR
|
||||
artifacts:
|
||||
|
@ -2,16 +2,18 @@
|
||||
code-quality:
|
||||
extends: .recompile-branch
|
||||
stage: check
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
||||
script:
|
||||
- ln -s /dockercache/cache-all target
|
||||
- rm -r target/debug/incremental/veloren_* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
- ln -s /dockercache/target target
|
||||
- rm -r target/debug/incremental/* || echo "all good" # TMP FIX FOR 2021-03-22-nightly
|
||||
- cargo clippy --all-targets --locked -- -D warnings
|
||||
- cargo fmt --all -- --check
|
||||
|
||||
security:
|
||||
extends: .recompile-branch
|
||||
stage: check
|
||||
image: registry.gitlab.com/veloren/veloren-docker-ci/cache/quality:${CACHE_IMAGE_TAG}
|
||||
allow_failure: true
|
||||
script:
|
||||
- ln -s /dockercache/cache-all target
|
||||
- ln -s /dockercache/target target
|
||||
- cargo audit
|
||||
|
@ -2,8 +2,6 @@
|
||||
# https://gitlab.com/veloren/veloren/container_registry
|
||||
.publish:
|
||||
stage: publish
|
||||
tags:
|
||||
- veloren-docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule"
|
||||
when: always
|
||||
@ -11,8 +9,6 @@
|
||||
|
||||
.publish-nightly:
|
||||
stage: publish
|
||||
tags:
|
||||
- veloren-docker
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
when: always
|
||||
@ -53,4 +49,4 @@ pages:
|
||||
- rm -rf public
|
||||
- mkdir -p public
|
||||
- cargo doc --no-deps --document-private-items
|
||||
- mv target/doc/* public
|
||||
- mv target/doc/* public
|
||||
|
@ -1,7 +1,5 @@
|
||||
# Template to only run if actual changes has been made to the code and not just documentation
|
||||
.recompile-branch:
|
||||
tags:
|
||||
- veloren-docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME !~ /^master$/
|
||||
# No '-' here is *very* important: https://docs.gitlab.com/ee/ci/yaml/#complex-rule-clauses
|
||||
@ -14,8 +12,6 @@
|
||||
|
||||
# like .recompile-branch but will run on master too
|
||||
.recompile:
|
||||
tags:
|
||||
- veloren-docker
|
||||
rules:
|
||||
- changes:
|
||||
- "**/*.{glsl,rs,ron,toml,vox,png,wav}"
|
||||
@ -27,8 +23,6 @@
|
||||
# Template to only run these after a branch has merged to master
|
||||
.post-merge:
|
||||
stage: build
|
||||
tags:
|
||||
- veloren-docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME =~ /^master$/
|
||||
changes:
|
||||
|
@ -1,8 +1,6 @@
|
||||
# allow_failure: true makes these pipelines manual and "non-blocking" which changed with except -> rule syntax
|
||||
.optional-release:
|
||||
stage: check
|
||||
tags:
|
||||
- veloren-docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME =~ /^master$/ || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/ || $CI_PIPELINE_SOURCE == "schedule"
|
||||
when: never
|
||||
@ -12,8 +10,6 @@
|
||||
# Template to only run if pushes to master or a tag happened
|
||||
.release:
|
||||
stage: build
|
||||
tags:
|
||||
- veloren-docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME =~ /^master$/ || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/
|
||||
when: always
|
||||
@ -22,9 +18,7 @@
|
||||
# Template to only run if pushes to master or a tag happened
|
||||
.release-nightly-tmp-fix-airshipper:
|
||||
stage: build-nightly
|
||||
tags:
|
||||
- veloren-docker
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" && ($CI_COMMIT_REF_NAME =~ /^master$/ || $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/ || $CI_COMMIT_REF_NAME =~ /^r[0-9]+\.[0-9]+/)
|
||||
when: always
|
||||
- when: never
|
||||
- when: never
|
||||
|
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -3562,9 +3562,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "packed_simd_2"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3278e0492f961fd4ae70909f56b2723a7e8d01a228427294e19cdfdebda89a17"
|
||||
checksum = "0e64858a2d3733fdd61adfdd6da89aa202f7ff0e741d2fc7ed1e452ba9dc99d7"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"libm 0.1.4",
|
||||
|
21
Cargo.toml
21
Cargo.toml
@ -34,17 +34,20 @@ panic = "abort"
|
||||
debug = false
|
||||
codegen-units = 8
|
||||
lto = false
|
||||
# TEMP false to avoid fingerprints bug
|
||||
incremental = false
|
||||
incremental = true
|
||||
# All dependencies (but not this crate itself)
|
||||
[profile.dev.package."*"]
|
||||
# TODO: seems like opt-level=2 should be sufficient here....
|
||||
opt-level = 3
|
||||
[profile.dev.package."veloren-network"]
|
||||
opt-level = 2
|
||||
[profile.dev.package."veloren-network-protocol"]
|
||||
opt-level = 3
|
||||
incremental = false
|
||||
[profile.dev.package."veloren-common"]
|
||||
opt-level = 2
|
||||
[profile.dev.package."veloren-common-systems"]
|
||||
incremental = false
|
||||
[profile.dev.package."veloren-client"]
|
||||
opt-level = 2
|
||||
[profile.dev.package."veloren-server"]
|
||||
@ -52,18 +55,13 @@ opt-level = 2
|
||||
[profile.dev.package."veloren-server-cli"]
|
||||
opt-level = 2
|
||||
[profile.dev.package."veloren-voxygen"]
|
||||
incremental = true
|
||||
opt-level = 2
|
||||
[profile.dev.package."veloren-world"]
|
||||
opt-level = 2
|
||||
|
||||
[profile.no_overflow.package."veloren-world"]
|
||||
opt-level = 3
|
||||
|
||||
[profile.no_overflow.package."veloren-voxygen-anim"]
|
||||
opt-level = 3
|
||||
|
||||
# this profile is used by developers if dev doesn't has enough debug information, the name must != debug, as debug is used by dev because....
|
||||
# this profile is used by developers if dev doesn't has enough debug information,
|
||||
# the name must != debug, as debug is used by dev because....
|
||||
[profile.debuginfo]
|
||||
inherits= 'dev'
|
||||
debug = true
|
||||
@ -75,6 +73,11 @@ inherits= 'dev'
|
||||
overflow-checks = false
|
||||
debug-assertions = false
|
||||
|
||||
[profile.no_overflow.package."veloren-world"]
|
||||
opt-level = 3
|
||||
[profile.no_overflow.package."veloren-voxygen-anim"]
|
||||
opt-level = 3
|
||||
|
||||
# this profile is used for veloren releases, compile time doesn't matter
|
||||
# we need stacktraces, light debug information, as much checks as possible
|
||||
# I would like to put it in a seperate `official_release` target, but that doesnt share caches with `cargo test` and `cargo bench`
|
||||
|
@ -12,7 +12,7 @@ use vek::*;
|
||||
/// streams though). It's used to verify the correctness of the state in
|
||||
/// debug_assertions
|
||||
#[derive(Debug, Clone)]
|
||||
#[allow(clippy::clippy::large_enum_variant)]
|
||||
#[allow(clippy::large_enum_variant)] // TODO: this is used for pings so we should probably look into lowering enum size (doesn't effect bandwidth but could effect CPU costs)
|
||||
pub enum ClientMsg {
|
||||
///Send on the first connection ONCE to identify client intention for
|
||||
/// server
|
||||
|
@ -49,7 +49,7 @@ pub struct ServerInfo {
|
||||
|
||||
/// Reponse To ClientType
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[allow(clippy::clippy::large_enum_variant)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ServerInit {
|
||||
TooManyPlayers,
|
||||
GameSync {
|
||||
|
@ -172,7 +172,7 @@ impl From<Body> for super::Body {
|
||||
}
|
||||
|
||||
impl Body {
|
||||
pub fn to_string(&self) -> &str {
|
||||
pub fn to_string(self) -> &'static str {
|
||||
match self {
|
||||
Body::Arrow => "arrow",
|
||||
Body::Bomb => "bomb",
|
||||
|
@ -607,6 +607,7 @@ impl Inventory {
|
||||
/// Unequip an item from slot and place into inventory. Will leave the item
|
||||
/// equipped if inventory has no slots available.
|
||||
#[must_use = "Returned items will be lost if not used"]
|
||||
#[allow(clippy::needless_collect)] // This is a false positive, the collect is needed
|
||||
pub fn unequip(&mut self, equip_slot: EquipSlot) -> Result<Option<Vec<Item>>, SlotError> {
|
||||
// Ensure there is enough space in the inventory to place the unequipped item
|
||||
if self.free_slots_minus_equipped_item(equip_slot) == 0 {
|
||||
|
@ -130,9 +130,7 @@ fn free_slots_minus_equipped_item_items_only_present_in_equipped_bag_slots() {
|
||||
inv.loadout
|
||||
.swap(bag1_slot, Some(bag.duplicate(ability_map, msm)));
|
||||
|
||||
inv.insert_at(InvSlotId::new(15, 0), bag)
|
||||
.unwrap()
|
||||
.unwrap_none();
|
||||
assert!(inv.insert_at(InvSlotId::new(15, 0), bag).unwrap().is_none());
|
||||
|
||||
let result = inv.free_slots_minus_equipped_item(bag1_slot);
|
||||
|
||||
@ -156,9 +154,7 @@ fn free_slots_minus_equipped_item() {
|
||||
Some(bag.duplicate(ability_map, msm)),
|
||||
);
|
||||
|
||||
inv.insert_at(InvSlotId::new(16, 0), bag)
|
||||
.unwrap()
|
||||
.unwrap_none();
|
||||
assert!(inv.insert_at(InvSlotId::new(16, 0), bag).unwrap().is_none());
|
||||
|
||||
let result = inv.free_slots_minus_equipped_item(bag1_slot);
|
||||
|
||||
@ -247,7 +243,7 @@ fn unequip_items_both_hands() {
|
||||
// We have space in the inventory, so this should have unequipped
|
||||
assert_eq!(None, inv.equipped(EquipSlot::ActiveMainhand));
|
||||
assert_eq!(18, inv.populated_slots());
|
||||
assert_eq!(true, result.is_ok());
|
||||
assert!(result.is_ok());
|
||||
|
||||
let result = inv.unequip(EquipSlot::InactiveMainhand).unwrap_err();
|
||||
assert_eq!(SlotError::InventoryFull, result);
|
||||
@ -303,9 +299,11 @@ fn equip_equipping_smaller_bag_from_last_slot_of_big_bag() {
|
||||
let small_bag = get_test_bag(9);
|
||||
let large_bag = Item::new_from_asset_expect(LARGE_BAG_ID);
|
||||
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(large_bag))
|
||||
.unwrap_none();
|
||||
assert!(
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(large_bag))
|
||||
.is_none()
|
||||
);
|
||||
|
||||
inv.insert_at(InvSlotId::new(15, 15), small_bag).unwrap();
|
||||
|
||||
@ -326,9 +324,11 @@ fn unequip_unequipping_bag_into_its_own_slot_with_no_other_free_slots() {
|
||||
let mut inv = Inventory::new_empty();
|
||||
let bag = get_test_bag(9);
|
||||
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag))
|
||||
.unwrap_none();
|
||||
assert!(
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag))
|
||||
.is_none()
|
||||
);
|
||||
|
||||
// Fill all inventory built-in slots
|
||||
fill_inv_slots(&mut inv, 18);
|
||||
@ -345,12 +345,14 @@ fn equip_one_bag_equipped_equip_second_bag() {
|
||||
let mut inv = Inventory::new_empty();
|
||||
|
||||
let bag = get_test_bag(9);
|
||||
inv.loadout
|
||||
.swap(
|
||||
EquipSlot::Armor(ArmorSlot::Bag1),
|
||||
Some(bag.duplicate(ability_map, msm)),
|
||||
)
|
||||
.unwrap_none();
|
||||
assert!(
|
||||
inv.loadout
|
||||
.swap(
|
||||
EquipSlot::Armor(ArmorSlot::Bag1),
|
||||
Some(bag.duplicate(ability_map, msm)),
|
||||
)
|
||||
.is_none()
|
||||
);
|
||||
|
||||
inv.push(bag).unwrap();
|
||||
|
||||
@ -364,9 +366,11 @@ fn free_after_swap_equipped_item_has_more_slots() {
|
||||
let mut inv = Inventory::new_empty();
|
||||
|
||||
let bag = get_test_bag(18);
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag))
|
||||
.unwrap_none();
|
||||
assert!(
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag))
|
||||
.is_none()
|
||||
);
|
||||
|
||||
let small_bag = get_test_bag(9);
|
||||
inv.push(small_bag).unwrap();
|
||||
@ -385,9 +389,11 @@ fn free_after_swap_equipped_item_has_less_slots() {
|
||||
let mut inv = Inventory::new_empty();
|
||||
|
||||
let bag = get_test_bag(9);
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag))
|
||||
.unwrap_none();
|
||||
assert!(
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag))
|
||||
.is_none()
|
||||
);
|
||||
|
||||
let small_bag = get_test_bag(18);
|
||||
inv.push(small_bag).unwrap();
|
||||
@ -406,9 +412,11 @@ fn free_after_swap_equipped_item_with_slots_swapped_with_empty_inv_slot() {
|
||||
let mut inv = Inventory::new_empty();
|
||||
|
||||
let bag = get_test_bag(9);
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag))
|
||||
.unwrap_none();
|
||||
assert!(
|
||||
inv.loadout
|
||||
.swap(EquipSlot::Armor(ArmorSlot::Bag1), Some(bag))
|
||||
.is_none()
|
||||
);
|
||||
|
||||
// Add 5 items to the inventory
|
||||
fill_inv_slots(&mut inv, 5);
|
||||
|
@ -670,7 +670,7 @@ mod tests {
|
||||
|
||||
assert_eq!(skillset.skill_groups[1].available_sp, 0);
|
||||
assert_eq!(skillset.skills.len(), 1);
|
||||
assert_eq!(skillset.has_skill(Skill::Axe(AxeSkill::UnlockLeap)), true);
|
||||
assert!(skillset.has_skill(Skill::Axe(AxeSkill::UnlockLeap)));
|
||||
|
||||
skillset.refund_skill(Skill::Axe(AxeSkill::UnlockLeap));
|
||||
|
||||
@ -705,7 +705,7 @@ mod tests {
|
||||
|
||||
assert_eq!(skillset.skill_groups[1].available_sp, 0);
|
||||
assert_eq!(skillset.skills.len(), 1);
|
||||
assert_eq!(skillset.has_skill(Skill::Axe(AxeSkill::UnlockLeap)), true);
|
||||
assert!(skillset.has_skill(Skill::Axe(AxeSkill::UnlockLeap)));
|
||||
|
||||
// Try unlocking a skill without enough skill points
|
||||
skillset.unlock_skill(Skill::Axe(AxeSkill::DsCombo));
|
||||
|
@ -204,7 +204,7 @@ impl<E> EventBus<E> {
|
||||
pub fn emit_now(&self, event: E) { self.queue.lock().unwrap().push_back(event); }
|
||||
|
||||
pub fn recv_all(&self) -> impl ExactSizeIterator<Item = E> {
|
||||
std::mem::replace(self.queue.lock().unwrap().deref_mut(), VecDeque::new()).into_iter()
|
||||
std::mem::take(self.queue.lock().unwrap().deref_mut()).into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,10 +11,7 @@
|
||||
fundamental,
|
||||
iter_map_while,
|
||||
label_break_value,
|
||||
option_expect_none,
|
||||
option_unwrap_none,
|
||||
option_zip,
|
||||
or_patterns,
|
||||
trait_alias,
|
||||
type_alias_impl_trait
|
||||
)]
|
||||
|
@ -91,7 +91,7 @@ pub struct TerrainChunkMeta {
|
||||
contains_dungeon: bool,
|
||||
}
|
||||
|
||||
#[allow(clippy::clippy::too_many_arguments)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
impl TerrainChunkMeta {
|
||||
pub fn new(
|
||||
name: Option<String>,
|
||||
|
@ -257,7 +257,7 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
|
||||
// Controller actions
|
||||
let actions = std::mem::replace(&mut controller.actions, Vec::new());
|
||||
let actions = std::mem::take(&mut controller.actions);
|
||||
|
||||
let mut join_struct = JoinStruct {
|
||||
entity,
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(bool_to_option, option_unwrap_none, array_map)]
|
||||
#![feature(bool_to_option, array_map)]
|
||||
#![allow(clippy::option_map_unit_fn)]
|
||||
|
||||
mod aura;
|
||||
|
@ -112,7 +112,7 @@ impl Pid {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn to_bytes(&self, bytes: &mut BytesMut) { bytes.put_u128_le(self.internal) }
|
||||
pub(crate) fn to_bytes(self, bytes: &mut BytesMut) { bytes.put_u128_le(self.internal) }
|
||||
}
|
||||
|
||||
impl Sid {
|
||||
@ -128,7 +128,7 @@ impl Sid {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn to_bytes(&self, bytes: &mut BytesMut) { bytes.put_u64_le(self.internal) }
|
||||
pub(crate) fn to_bytes(self, bytes: &mut BytesMut) { bytes.put_u64_le(self.internal) }
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Pid {
|
||||
|
@ -1159,10 +1159,11 @@ impl Drop for Participant {
|
||||
impl Drop for Stream {
|
||||
#[instrument(name="remote", skip(self), fields(p = %self.remote_pid))]
|
||||
#[instrument(name="network", skip(self), fields(p = %self.local_pid))]
|
||||
|
||||
fn drop(&mut self) {
|
||||
// send if closed is unnecessary but doesn't hurt, we must not crash
|
||||
let sid = self.sid;
|
||||
if !self.send_closed.load(Ordering::Relaxed) {
|
||||
let sid = self.sid;
|
||||
debug!(?sid, "Shutting down Stream");
|
||||
if let Err(e) = self.a2b_close_stream_s.take().unwrap().send(self.sid) {
|
||||
debug!(
|
||||
@ -1171,7 +1172,6 @@ impl Drop for Stream {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
let sid = self.sid;
|
||||
trace!(?sid, "Stream Drop not needed");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(const_fn)]
|
||||
|
||||
pub extern crate plugin_derive;
|
||||
|
||||
pub mod retrieve;
|
||||
|
@ -1 +1 @@
|
||||
nightly-2021-03-22
|
||||
nightly-2021-05-18
|
||||
|
@ -781,10 +781,9 @@ mod tests {
|
||||
let position = Pos(Vec3::zero());
|
||||
let item_position = Pos(Vec3::one());
|
||||
|
||||
assert_eq!(
|
||||
within_pickup_range(test_cylinder(position), || test_cylinder(item_position),),
|
||||
true
|
||||
);
|
||||
assert!(within_pickup_range(test_cylinder(position), || {
|
||||
test_cylinder(item_position)
|
||||
},),);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -792,9 +791,8 @@ mod tests {
|
||||
let position = Pos(Vec3::zero());
|
||||
let item_position = Pos(Vec3::one() * 500.0);
|
||||
|
||||
assert_eq!(
|
||||
within_pickup_range(test_cylinder(position), || test_cylinder(item_position),),
|
||||
false
|
||||
);
|
||||
assert!(!within_pickup_range(test_cylinder(position), || {
|
||||
test_cylinder(item_position)
|
||||
},),);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
bool_to_option,
|
||||
drain_filter,
|
||||
never_type,
|
||||
option_unwrap_none,
|
||||
option_zip,
|
||||
unwrap_infallible
|
||||
)]
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::branches_sharing_code)] // TODO: evaluate
|
||||
|
||||
use crate::rtsim::{Entity as RtSimData, RtSim};
|
||||
use common::{
|
||||
comp::{
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(const_generics)]
|
||||
#![feature(or_patterns)]
|
||||
#![feature(generic_associated_types)]
|
||||
#![allow(incomplete_features)]
|
||||
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
|
||||
|
@ -15,7 +15,7 @@ fn no_item_config_no_emit() {
|
||||
let previous_state = PreviousEntityState::default();
|
||||
let result = MovementEventMapper::should_emit(&previous_state, None);
|
||||
|
||||
assert_eq!(result, false);
|
||||
assert!(!result);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -39,7 +39,7 @@ fn config_but_played_since_threshold_no_emit() {
|
||||
Some((&SfxEvent::Run(BlockKind::Grass), &trigger_item)),
|
||||
);
|
||||
|
||||
assert_eq!(result, false);
|
||||
assert!(!result);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -62,7 +62,7 @@ fn config_and_not_played_since_threshold_emits() {
|
||||
Some((&SfxEvent::Run(BlockKind::Grass), &trigger_item)),
|
||||
);
|
||||
|
||||
assert_eq!(result, true);
|
||||
assert!(result);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -87,7 +87,7 @@ fn same_previous_event_elapsed_emits() {
|
||||
Some((&SfxEvent::Run(BlockKind::Grass), &trigger_item)),
|
||||
);
|
||||
|
||||
assert_eq!(result, true);
|
||||
assert!(result);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -956,7 +956,7 @@ impl Hud {
|
||||
interactable: Option<Interactable>,
|
||||
) -> Vec<Event> {
|
||||
span!(_guard, "update_layout", "Hud::update_layout");
|
||||
let mut events = std::mem::replace(&mut self.events, Vec::new());
|
||||
let mut events = core::mem::take(&mut self.events);
|
||||
let (ref mut ui_widgets, ref mut item_tooltip_manager, ref mut tooltip_manager) =
|
||||
&mut self.ui.set_widgets();
|
||||
// self.ui.set_item_widgets(); pulse time for pulsating elements
|
||||
|
@ -2,14 +2,7 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![allow(clippy::option_map_unit_fn)]
|
||||
#![deny(clippy::clone_on_ref_ptr)]
|
||||
#![feature(
|
||||
array_map,
|
||||
bool_to_option,
|
||||
const_generics,
|
||||
drain_filter,
|
||||
once_cell,
|
||||
or_patterns
|
||||
)]
|
||||
#![feature(array_map, bool_to_option, const_generics, drain_filter, once_cell)]
|
||||
#![recursion_limit = "2048"]
|
||||
|
||||
#[macro_use]
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(clippy::clone_on_copy)] // TODO: fix after wgpu branch
|
||||
|
||||
use crate::{
|
||||
mesh::{
|
||||
greedy::{self, GreedyConfig, GreedyMesh},
|
||||
|
@ -79,6 +79,7 @@ impl slider::Renderer for IcedRenderer {
|
||||
mouse::Interaction::Idle
|
||||
};
|
||||
|
||||
#[allow(clippy::branches_sharing_code)] // TODO: remove
|
||||
#[allow(clippy::if_same_then_else)] // TODO: remove
|
||||
let primitives = if style.labels {
|
||||
// TODO text label on left and right ends
|
||||
|
@ -530,6 +530,7 @@ impl Ui {
|
||||
});
|
||||
|
||||
if glyph_missing {
|
||||
#[allow(clippy::branches_sharing_code)] // TODO: evaluate (ask sharp)
|
||||
if *retry {
|
||||
// If a glyph was missing and this was our second try, we know something was
|
||||
// messed up during the glyph_cache redraw. It is possible that
|
||||
|
@ -194,8 +194,8 @@ where
|
||||
|
||||
pub fn maintain(&mut self, ui: &mut conrod_core::UiCell) -> Vec<Event<S>> {
|
||||
// Clear
|
||||
let slot_ids = std::mem::replace(&mut self.slot_ids, Vec::new());
|
||||
let slots = std::mem::replace(&mut self.slots, Vec::new());
|
||||
let slot_ids = core::mem::take(&mut self.slot_ids);
|
||||
let slots = core::mem::take(&mut self.slots);
|
||||
|
||||
// Detect drops by of selected item by clicking in empty space
|
||||
if let ManagerState::Selected(_, slot) = self.state {
|
||||
@ -295,7 +295,7 @@ where
|
||||
// }
|
||||
}
|
||||
|
||||
std::mem::replace(&mut self.events, Vec::new())
|
||||
core::mem::take(&mut self.events)
|
||||
}
|
||||
|
||||
fn update(
|
||||
|
@ -975,13 +975,14 @@ impl Window {
|
||||
if let (true, Some(game_inputs)) =
|
||||
// Mouse input not mapped to input if it is not grabbed
|
||||
(
|
||||
self.cursor_grabbed,
|
||||
Window::map_input(
|
||||
KeyMouse::Mouse(button),
|
||||
controls,
|
||||
&mut self.remapping_keybindings,
|
||||
),
|
||||
) {
|
||||
self.cursor_grabbed,
|
||||
Window::map_input(
|
||||
KeyMouse::Mouse(button),
|
||||
controls,
|
||||
&mut self.remapping_keybindings,
|
||||
),
|
||||
)
|
||||
{
|
||||
for game_input in game_inputs {
|
||||
self.events.push(Event::InputUpdate(
|
||||
*game_input,
|
||||
|
@ -31,7 +31,7 @@ tracing = { version = "0.1", default-features = false }
|
||||
rand = "0.8"
|
||||
rand_chacha = "0.3"
|
||||
arr_macro = "0.1.2"
|
||||
packed_simd = { version = "0.3.4", package = "packed_simd_2" }
|
||||
packed_simd = { package = "packed_simd_2", version = "0.3.5" }
|
||||
rayon = "1.5"
|
||||
serde = { version = "1.0.110", features = ["derive"] }
|
||||
ron = { version = "0.6", default-features = false }
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![allow(clippy::branches_sharing_code)] // TODO: evaluate
|
||||
use common::{
|
||||
terrain::{
|
||||
map::{MapConfig, MapDebug, MapSample},
|
||||
|
@ -5,6 +5,7 @@
|
||||
clippy::blocks_in_if_conditions,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
#![allow(clippy::branches_sharing_code)] // TODO: evaluate
|
||||
#![deny(clippy::clone_on_ref_ptr)]
|
||||
#![feature(
|
||||
arbitrary_enum_discriminant,
|
||||
@ -12,7 +13,6 @@
|
||||
const_generics,
|
||||
const_panic,
|
||||
label_break_value,
|
||||
or_patterns,
|
||||
array_map
|
||||
)]
|
||||
|
||||
|
@ -116,17 +116,18 @@ pub(crate) struct GenCtx {
|
||||
pub warp_nz: FastNoise,
|
||||
pub tree_nz: BasicMulti,
|
||||
|
||||
pub cave_0_nz: SuperSimplex,
|
||||
pub cave_1_nz: SuperSimplex,
|
||||
// TODO: unused, remove??? @zesterer
|
||||
pub _cave_0_nz: SuperSimplex,
|
||||
pub _cave_1_nz: SuperSimplex,
|
||||
|
||||
pub structure_gen: StructureGen2d,
|
||||
pub big_structure_gen: StructureGen2d,
|
||||
pub region_gen: StructureGen2d,
|
||||
pub _big_structure_gen: StructureGen2d,
|
||||
pub _region_gen: StructureGen2d,
|
||||
|
||||
pub fast_turb_x_nz: FastNoise,
|
||||
pub fast_turb_y_nz: FastNoise,
|
||||
pub _fast_turb_x_nz: FastNoise,
|
||||
pub _fast_turb_y_nz: FastNoise,
|
||||
|
||||
pub town_gen: StructureGen2d,
|
||||
pub _town_gen: StructureGen2d,
|
||||
pub river_seed: RandomField,
|
||||
pub rock_strength_nz: Fbm,
|
||||
pub uplift_nz: Worley,
|
||||
@ -521,22 +522,22 @@ impl WorldSim {
|
||||
.set_octaves(12)
|
||||
.set_persistence(0.75)
|
||||
.set_seed(rng.gen()),
|
||||
cave_0_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
cave_1_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
_cave_0_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
_cave_1_nz: SuperSimplex::new().set_seed(rng.gen()),
|
||||
|
||||
structure_gen: StructureGen2d::new(rng.gen(), 24, 10),
|
||||
big_structure_gen: StructureGen2d::new(rng.gen(), 768, 512),
|
||||
region_gen: StructureGen2d::new(rng.gen(), 400, 96),
|
||||
_big_structure_gen: StructureGen2d::new(rng.gen(), 768, 512),
|
||||
_region_gen: StructureGen2d::new(rng.gen(), 400, 96),
|
||||
humid_nz: Billow::new()
|
||||
.set_octaves(9)
|
||||
.set_persistence(0.4)
|
||||
.set_frequency(0.2)
|
||||
.set_seed(rng.gen()),
|
||||
|
||||
fast_turb_x_nz: FastNoise::new(rng.gen()),
|
||||
fast_turb_y_nz: FastNoise::new(rng.gen()),
|
||||
_fast_turb_x_nz: FastNoise::new(rng.gen()),
|
||||
_fast_turb_y_nz: FastNoise::new(rng.gen()),
|
||||
|
||||
town_gen: StructureGen2d::new(rng.gen(), 2048, 1024),
|
||||
_town_gen: StructureGen2d::new(rng.gen(), 2048, 1024),
|
||||
river_seed: RandomField::new(rng.gen()),
|
||||
rock_strength_nz: Fbm::new()
|
||||
.set_octaves(10)
|
||||
|
@ -581,12 +581,12 @@ pub struct HybridMulti {
|
||||
|
||||
impl HybridMulti {
|
||||
pub const DEFAULT_FREQUENCY: f64 = 2.0;
|
||||
pub const DEFAULT_LACUNARITY: f64 = /* std::f64::consts::PI * 2.0 / 3.0 */2.0;
|
||||
pub const DEFAULT_LACUNARITY: f64 = /* std::f64::consts::PI * 2.0 / 3.0 */ 2.0;
|
||||
pub const DEFAULT_OCTAVES: usize = 6;
|
||||
pub const DEFAULT_OFFSET: f64 = /* 0.25 *//* 0.5*/ 0.7;
|
||||
pub const DEFAULT_OFFSET: f64 = /* 0.25 *//* 0.5 */ 0.7;
|
||||
// -ln(2^(-0.25))/ln(2) = 0.25
|
||||
// 2^(-0.25) ~ 13/16
|
||||
pub const DEFAULT_PERSISTENCE: f64 = /* 0.25 *//* 0.5*/ 13.0 / 16.0;
|
||||
pub const DEFAULT_PERSISTENCE: f64 = /* 0.25 *//* 0.5 */ 13.0 / 16.0;
|
||||
pub const DEFAULT_SEED: u32 = 0;
|
||||
pub const MAX_OCTAVES: usize = 32;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user