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

xMAC94x/update toolchain

See merge request veloren/veloren!3027
This commit is contained in:
Marcel 2021-11-26 16:52:51 +00:00
commit 3fa2dab3aa
41 changed files with 150 additions and 111 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: f4db383e CACHE_IMAGE_TAG: a4f7c998
default: default:
# https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines # https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines

View File

@ -93,7 +93,7 @@ impl Tui {
if [HelpDisplayed, MissingRequiredArgument, UnknownArgument].contains(&e.kind) => if [HelpDisplayed, MissingRequiredArgument, UnknownArgument].contains(&e.kind) =>
{ {
println!("{}", e.message); println!("{}", e.message);
} },
Err(e) => { Err(e) => {
error!("{:?}", e); error!("{:?}", e);
return false; return false;

View File

@ -84,7 +84,7 @@ where
let filter = match std::env::var_os(RUST_LOG_ENV).map(|s| s.into_string()) { let filter = match std::env::var_os(RUST_LOG_ENV).map(|s| s.into_string()) {
Some(Ok(env)) => { Some(Ok(env)) => {
let mut filter = base_exceptions(EnvFilter::new("")); let mut filter = base_exceptions(EnvFilter::new(""));
for s in env.split(',').into_iter() { for s in env.split(',') {
match s.parse() { match s.parse() {
Ok(d) => filter = filter.add_directive(d), Ok(d) => filter = filter.add_directive(d),
Err(err) => println!("WARN ignoring log directive: `{}`: {}", s, err), Err(err) => println!("WARN ignoring log directive: `{}`: {}", s, err),

View File

@ -171,7 +171,7 @@ impl Attack {
1.0 - (1.0 - damage_reduction) * (1.0 - block_reduction) 1.0 - (1.0 - damage_reduction) * (1.0 - block_reduction)
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments, clippy::redundant_closure)]
pub fn apply_attack( pub fn apply_attack(
&self, &self,
attacker: Option<AttackerInfo>, attacker: Option<AttackerInfo>,

View File

@ -779,7 +779,7 @@ impl Item {
/// Returns an iterator that drains items contained within the item's slots /// Returns an iterator that drains items contained within the item's slots
pub fn drain(&mut self) -> impl Iterator<Item = Item> + '_ { pub fn drain(&mut self) -> impl Iterator<Item = Item> + '_ {
self.slots.iter_mut().filter_map(|x| mem::take(x)) self.slots.iter_mut().filter_map(mem::take)
} }
pub fn item_definition_id(&self) -> &str { &self.item_def.item_definition_id } pub fn item_definition_id(&self) -> &str { &self.item_def.item_definition_id }

View File

@ -94,9 +94,12 @@ impl ItemSpec {
match self { match self {
ItemSpec::Item(specifier) => { ItemSpec::Item(specifier) => {
let item = Item::new_from_asset_expect(specifier); let item = Item::new_from_asset_expect(specifier);
if !equip_slot.can_hold(&item.kind) { assert!(
panic!("Tried to place {} into {:?}", specifier, equip_slot); equip_slot.can_hold(&item.kind),
} "Tried to place {} into {:?}",
specifier,
equip_slot
);
std::mem::drop(item); std::mem::drop(item);
}, },
ItemSpec::Choice(items) => { ItemSpec::Choice(items) => {

View File

@ -121,7 +121,7 @@ impl Inventory {
/// Sorts the inventory using the next sort order /// Sorts the inventory using the next sort order
pub fn sort(&mut self) { pub fn sort(&mut self) {
let sort_order = self.next_sort_order; let sort_order = self.next_sort_order;
let mut items: Vec<Item> = self.slots_mut().filter_map(|x| mem::take(x)).collect(); let mut items: Vec<Item> = self.slots_mut().filter_map(mem::take).collect();
items.sort_by(|a, b| match sort_order { items.sort_by(|a, b| match sort_order {
InventorySortOrder::Name => Ord::cmp(a.name(), b.name()), InventorySortOrder::Name => Ord::cmp(a.name(), b.name()),

View File

@ -11,7 +11,8 @@
option_zip, option_zip,
trait_alias, trait_alias,
type_alias_impl_trait, type_alias_impl_trait,
extend_one extend_one,
arbitrary_enum_discriminant
)] )]
#![feature(hash_drain_filter)] #![feature(hash_drain_filter)]

View File

@ -170,7 +170,7 @@ pub fn try_salvage(
let salvage_item = inv.get(slot).expect("Expected item to exist in inventory"); let salvage_item = inv.get(slot).expect("Expected item to exist in inventory");
let salvage_output: Vec<_> = salvage_item let salvage_output: Vec<_> = salvage_item
.salvage_output() .salvage_output()
.map(|asset| Item::new_from_asset_expect(asset)) .map(Item::new_from_asset_expect)
.collect(); .collect();
if salvage_output.is_empty() { if salvage_output.is_empty() {
// If no output items, assume salvaging was a failure // If no output items, assume salvaging was a failure

View File

@ -285,8 +285,8 @@ impl SpriteKind {
/// What loot table does collecting this sprite draw from? /// What loot table does collecting this sprite draw from?
#[inline] #[inline]
pub fn collectible_id(&self) -> Option<LootSpec<&'static str>> { pub fn collectible_id(&self) -> Option<LootSpec<&'static str>> {
let item = |id: &'static str| LootSpec::Item(id); let item = LootSpec::Item;
let table = |id: &'static str| LootSpec::LootTable(id); let table = LootSpec::LootTable;
Some(match self { Some(match self {
SpriteKind::Apple => item("common.items.food.apple"), SpriteKind::Apple => item("common.items.food.apple"),
SpriteKind::Mushroom => item("common.items.food.mushroom"), SpriteKind::Mushroom => item("common.items.food.mushroom"),

View File

@ -18,14 +18,14 @@ lazy_static::lazy_static! {
pub static ref GIT_DATE: String = GIT_DATETIME.split('-').take(3).collect::<Vec<&str>>().join("-"); pub static ref GIT_DATE: String = GIT_DATETIME.split('-').take(3).collect::<Vec<&str>>().join("-");
pub static ref GIT_TIME: &'static str = GIT_DATETIME.split('-').nth(3).expect("failed to retrieve git_time!"); pub static ref GIT_TIME: &'static str = GIT_DATETIME.split('-').nth(3).expect("failed to retrieve git_time!");
pub static ref DISPLAY_VERSION: String = if GIT_TAG.is_empty() { pub static ref DISPLAY_VERSION: String = if GIT_TAG.is_empty() {
format!("{}-{}", VELOREN_VERSION_STAGE, GIT_DATE.to_string()) format!("{}-{}", VELOREN_VERSION_STAGE, *GIT_DATE)
} else { } else {
format!("{}-{}", VELOREN_VERSION_STAGE, GIT_TAG.to_string()) format!("{}-{}", VELOREN_VERSION_STAGE, GIT_TAG)
}; };
pub static ref DISPLAY_VERSION_LONG: String = if GIT_TAG.is_empty() { pub static ref DISPLAY_VERSION_LONG: String = if GIT_TAG.is_empty() {
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_HASH.to_string()) format!("{} ({})", DISPLAY_VERSION.as_str(), *GIT_HASH)
} else { } else {
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION.to_string()) format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION)
}; };
} }

View File

@ -98,14 +98,14 @@ impl<'a> System<'a> for Sys {
entity, entity,
uid, uid,
mut char_state, mut char_state,
mut pos, pos,
mut vel, vel,
mut ori, ori,
mass, mass,
mut density, mut density,
energy, energy,
inventory, inventory,
mut controller, controller,
health, health,
body, body,
physics, physics,
@ -172,14 +172,14 @@ impl<'a> System<'a> for Sys {
entity, entity,
uid, uid,
char_state, char_state,
pos: &mut pos, pos,
vel: &mut vel, vel,
ori: &mut ori, ori,
mass, mass,
density: &mut density, density: &mut density,
energy, energy,
inventory, inventory,
controller: &mut controller, controller,
health, health,
body, body,
physics, physics,

View File

@ -355,7 +355,7 @@ impl<'a> PhysicsData<'a> {
mass, mass,
collider, collider,
sticky, sticky,
mut physics, physics,
projectile, projectile,
char_state_maybe, char_state_maybe,
)| { )| {
@ -455,7 +455,7 @@ impl<'a> PhysicsData<'a> {
&mut collision_registered, &mut collision_registered,
&mut entity_entity_collisions, &mut entity_entity_collisions,
factor, factor,
&mut physics, physics,
char_state_maybe, char_state_maybe,
&mut vel_delta, &mut vel_delta,
step_delta, step_delta,
@ -830,7 +830,7 @@ impl<'a> PhysicsData<'a> {
&mut cpos, &mut cpos,
tgt_pos, tgt_pos,
&mut vel, &mut vel,
&mut physics_state, physics_state,
Vec3::zero(), Vec3::zero(),
&read.dt, &read.dt,
was_on_ground, was_on_ground,
@ -862,7 +862,7 @@ impl<'a> PhysicsData<'a> {
&mut cpos, &mut cpos,
tgt_pos, tgt_pos,
&mut vel, &mut vel,
&mut physics_state, physics_state,
Vec3::zero(), Vec3::zero(),
&read.dt, &read.dt,
was_on_ground, was_on_ground,

View File

@ -1 +1 @@
nightly-2021-09-24 nightly-2021-11-24

View File

@ -969,7 +969,7 @@ fn handle_time(
0, 0,
); );
let msg = match current_time { let msg = match current_time {
Some(time) => format!("It is {}", time.format("%H:%M").to_string()), Some(time) => format!("It is {}", time.format("%H:%M")),
None => String::from("Unknown Time"), None => String::from("Unknown Time"),
}; };
server.notify_client( server.notify_client(
@ -1000,7 +1000,7 @@ fn handle_time(
client, client,
ServerGeneral::server_msg( ServerGeneral::server_msg(
ChatType::CommandInfo, ChatType::CommandInfo,
format!("Time changed to: {}", new_time.format("%H:%M").to_string(),), format!("Time changed to: {}", new_time.format("%H:%M")),
), ),
); );
} }
@ -2952,8 +2952,8 @@ fn handle_version(
ChatType::CommandInfo, ChatType::CommandInfo,
format!( format!(
"Server is running {}[{}]", "Server is running {}[{}]",
common::util::GIT_HASH.to_string(), *common::util::GIT_HASH,
common::util::GIT_DATE.to_string(), *common::util::GIT_DATE,
), ),
), ),
); );

View File

@ -119,7 +119,7 @@ pub fn handle_process_trade_action(
.ecs() .ecs()
.read_component::<Inventory>() .read_component::<Inventory>()
.get(e) .get(e)
.map(|i| ReducedInventory::from(i)); .map(ReducedInventory::from);
// Get price info from the first Agent in the trade (currently, an // Get price info from the first Agent in the trade (currently, an
// Agent will never initiate a trade with another agent though) // Agent will never initiate a trade with another agent though)
#[cfg(feature = "worldgen")] #[cfg(feature = "worldgen")]

View File

@ -445,7 +445,7 @@ impl Server {
state.ecs_mut().write_resource::<TimeOfDay>().0 = settings.start_time; state.ecs_mut().write_resource::<TimeOfDay>().0 = settings.start_time;
// Register trackers // Register trackers
sys::sentinel::register_trackers(&mut state.ecs_mut()); sys::sentinel::register_trackers(state.ecs_mut());
state.ecs_mut().insert(DeletedEntities::default()); state.ecs_mut().insert(DeletedEntities::default());

View File

@ -481,7 +481,7 @@ pub fn convert_body_from_database(
_ => { _ => {
return Err(PersistenceError::ConversionError(format!( return Err(PersistenceError::ConversionError(format!(
"{} is not a supported body type for deserialization", "{} is not a supported body type for deserialization",
variant.to_string() variant
))); )));
}, },
}) })
@ -516,8 +516,7 @@ fn get_item_from_asset(item_definition_id: &str) -> Result<common::comp::Item, P
common::comp::Item::new_from_asset(item_definition_id).map_err(|err| { common::comp::Item::new_from_asset(item_definition_id).map_err(|err| {
PersistenceError::AssetError(format!( PersistenceError::AssetError(format!(
"Error loading item asset: {} - {}", "Error loading item asset: {} - {}",
item_definition_id, item_definition_id, err
err.to_string()
)) ))
}) })
} }

View File

@ -553,7 +553,7 @@ impl<'a> System<'a> for Sys {
} }
} }
} }
} },
_ => {}, _ => {},
} }
@ -1464,7 +1464,7 @@ impl<'a> AgentData<'a> {
{ {
value += value +=
data.strength * data.duration.map_or(0.0, |d| d.as_secs() as f32); data.strength * data.duration.map_or(0.0, |d| d.as_secs() as f32);
} },
_ => {}, _ => {},
} }
} }

View File

@ -107,7 +107,7 @@ impl<'a> System<'a> for Sys {
let mut finished_pending = vec![]; let mut finished_pending = vec![];
let mut retries = vec![]; let mut retries = vec![];
for (entity, client, mut pending) in for (entity, client, pending) in
(&read_data.entities, &read_data.clients, &mut pending_logins).join() (&read_data.entities, &read_data.clients, &mut pending_logins).join()
{ {
if let Err(e) = || -> std::result::Result<(), crate::error::Error> { if let Err(e) = || -> std::result::Result<(), crate::error::Error> {
@ -121,7 +121,7 @@ impl<'a> System<'a> for Sys {
}; };
let (username, uuid) = match login_provider.login( let (username, uuid) = match login_provider.login(
&mut pending, pending,
#[cfg(feature = "plugins")] #[cfg(feature = "plugins")]
&ecs_world, &ecs_world,
#[cfg(feature = "plugins")] #[cfg(feature = "plugins")]

View File

@ -378,6 +378,8 @@ impl<'a> System<'a> for Sys {
/// Convinient structure to use when you need to create new npc /// Convinient structure to use when you need to create new npc
/// from EntityInfo /// from EntityInfo
// TODO: better name? // TODO: better name?
// TODO: if this is send around network, optimize the large_enum_variant
#[allow(clippy::large_enum_variant)]
pub enum NpcData { pub enum NpcData {
Data { Data {
pos: Pos, pos: Pos,

View File

@ -386,7 +386,7 @@ impl<'a> InventoryScroller<'a> {
if self.show_salvage && item.is_salvageable() { if self.show_salvage && item.is_salvageable() {
let salvage_result: Vec<_> = item let salvage_result: Vec<_> = item
.salvage_output() .salvage_output()
.map(|asset| Arc::<ItemDef>::load_expect_cloned(asset)) .map(Arc::<ItemDef>::load_expect_cloned)
.map(|item| item as Arc<dyn ItemDesc>) .map(|item| item as Arc<dyn ItemDesc>)
.collect(); .collect();

View File

@ -343,7 +343,7 @@ impl<'a> Widget for Chat<'a> {
// Chat input uses a rectangle as its background. // Chat input uses a rectangle as its background.
if input_focused { if input_focused {
// Shallow comparison of ChatMode. // Shallow comparison of ChatMode.
let discrim = |x| std::mem::discriminant(x); let discrim = std::mem::discriminant;
if discrim(&state.input.mode) != discrim(&self.client.chat_mode) { if discrim(&state.input.mode) != discrim(&self.client.chat_mode) {
state.update(|s| { state.update(|s| {
s.input.mode = self.client.chat_mode.clone(); s.input.mode = self.client.chat_mode.clone();

View File

@ -2348,15 +2348,12 @@ impl Hud {
(time_in_seconds as u64 % 86400) as u32, (time_in_seconds as u64 % 86400) as u32,
0, 0,
); );
Text::new(&format!( Text::new(&format!("Time: {}", current_time.format("%H:%M")))
"Time: {}", .color(TEXT_COLOR)
current_time.format("%H:%M").to_string() .down_from(self.ids.loaded_distance, V_PAD)
)) .font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR) .font_size(self.fonts.cyri.scale(14))
.down_from(self.ids.loaded_distance, V_PAD) .set(self.ids.time, ui_widgets);
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.set(self.ids.time, ui_widgets);
// Number of entities // Number of entities
let entity_count = client.state().ecs().entities().join().count(); let entity_count = client.state().ecs().entities().join().count();
@ -3875,7 +3872,7 @@ impl Hud {
// thread pool // thread pool
let _pool = client.state().ecs().read_resource::<SlowJobPool>(); let _pool = client.state().ecs().read_resource::<SlowJobPool>();
self.ui.maintain( self.ui.maintain(
&mut global_state.window.renderer_mut(), global_state.window.renderer_mut(),
None, None,
//Some(&pool), //Some(&pool),
Some(proj_mat * view_mat * Mat4::translation_3d(-focus_off)), Some(proj_mat * view_mat * Mat4::translation_3d(-focus_off)),

View File

@ -148,12 +148,12 @@ impl<'a> Ingameable for Overhead<'a> {
} else { } else {
0 0
} }
+ if info.health.map_or(false, |h| should_show_healthbar(h)) { + if info.health.map_or(false, should_show_healthbar) {
5 + if info.energy.is_some() { 1 } else { 0 } 5 + if info.energy.is_some() { 1 } else { 0 }
} else { } else {
0 0
} }
+ if info.health.map_or(false, |h| decayed_health_displayed(h)) { + if info.health.map_or(false, decayed_health_displayed) {
1 1
} else { } else {
0 0
@ -446,7 +446,7 @@ impl<'a> Widget for Overhead<'a> {
.parent(id) .parent(id)
.set(state.ids.level, ui); .set(state.ids.level, ui);
} }
} },
_ => {}, _ => {},
} }
} }

View File

@ -610,7 +610,7 @@ impl<'a> Skillbar<'a> {
.abilities .abilities
.get(i) .get(i)
.and_then(|a| Ability::from(*a).ability_id(Some(inventory))) .and_then(|a| Ability::from(*a).ability_id(Some(inventory)))
.map(|id| util::ability_description(id)), .map(util::ability_description),
}) })
}; };

View File

@ -256,7 +256,7 @@ impl<'a> Widget for Social<'a> {
None => format!( None => format!(
"{} [{}]", "{} [{}]",
alias.clone(), alias.clone(),
self.localized_strings.get("hud.group.in_menu").to_string() self.localized_strings.get("hud.group.in_menu")
), // character select or spectating ), // character select or spectating
}; };
let acc_name_txt = format!( let acc_name_txt = format!(

View File

@ -546,7 +546,7 @@ impl<'a> Widget for Trade<'a> {
fn update(mut self, args: widget::UpdateArgs<Self>) -> Self::Event { fn update(mut self, args: widget::UpdateArgs<Self>) -> Self::Event {
common_base::prof_span!("Trade::update"); common_base::prof_span!("Trade::update");
let widget::UpdateArgs { mut state, ui, .. } = args; let widget::UpdateArgs { state, ui, .. } = args;
let mut event = None; let mut event = None;
let (trade, prices) = match self.client.pending_trade() { let (trade, prices) = match self.client.pending_trade() {
@ -572,18 +572,14 @@ impl<'a> Widget for Trade<'a> {
}); });
} }
self.background(&mut state, ui); self.background(state, ui);
self.title(&mut state, ui); self.title(state, ui);
self.phase_indicator(&mut state, ui, trade); self.phase_indicator(state, ui, trade);
event = self event = self.item_pane(state, ui, trade, prices, false).or(event);
.item_pane(&mut state, ui, trade, prices, false) event = self.item_pane(state, ui, trade, prices, true).or(event);
.or(event); event = self.accept_decline_buttons(state, ui, trade).or(event);
event = self event = self.close_button(state, ui).or(event);
.item_pane(&mut state, ui, trade, prices, true)
.or(event);
event = self.accept_decline_buttons(&mut state, ui, trade).or(event);
event = self.close_button(&mut state, ui).or(event);
event event
} }

View File

@ -125,8 +125,8 @@ fn main() {
logs_dir.join(&log_filename).display(), logs_dir.join(&log_filename).display(),
reason, reason,
panic_info, panic_info,
common::util::GIT_HASH.to_string(), *common::util::GIT_HASH,
common::util::GIT_DATE.to_string() *common::util::GIT_DATE
); );
error!( error!(

View File

@ -812,8 +812,14 @@ impl Controls {
}; };
// TODO: tooltips // TODO: tooltips
let [ref mut human_button, ref mut orc_button, ref mut dwarf_button, ref mut elf_button, ref mut undead_button, ref mut danari_button] = let [
species_buttons; ref mut human_button,
ref mut orc_button,
ref mut dwarf_button,
ref mut elf_button,
ref mut undead_button,
ref mut danari_button,
] = species_buttons;
let species = Column::with_children(vec![ let species = Column::with_children(vec![
Row::with_children(vec![ Row::with_children(vec![
icon_button_tooltip( icon_button_tooltip(
@ -874,8 +880,14 @@ impl Controls {
]) ])
.spacing(1); .spacing(1);
let [ref mut sword_button, ref mut swords_button, ref mut axe_button, ref mut hammer_button, ref mut bow_button, ref mut staff_button] = let [
tool_buttons; ref mut sword_button,
ref mut swords_button,
ref mut axe_button,
ref mut hammer_button,
ref mut bow_button,
ref mut staff_button,
] = tool_buttons;
let tool = Column::with_children(vec![ let tool = Column::with_children(vec![
Row::with_children(vec![ Row::with_children(vec![
icon_button_tooltip( icon_button_tooltip(
@ -1245,7 +1257,7 @@ impl Controls {
i18n.get("main.login.server_version"), i18n.get("main.login.server_version"),
mismatched_version, mismatched_version,
i18n.get("main.login.client_version"), i18n.get("main.login.client_version"),
common::util::GIT_HASH.to_string() *common::util::GIT_HASH
)) ))
.size(self.fonts.cyri.scale(18)) .size(self.fonts.cyri.scale(18))
.color(iced::Color::from_rgb(1.0, 0.0, 0.0)) .color(iced::Color::from_rgb(1.0, 0.0, 0.0))
@ -1356,11 +1368,11 @@ impl Controls {
*offhand = value.1; *offhand = value.1;
inventory.replace_loadout_item( inventory.replace_loadout_item(
EquipSlot::ActiveMainhand, EquipSlot::ActiveMainhand,
mainhand.map(|specifier| Item::new_from_asset_expect(specifier)), mainhand.map(Item::new_from_asset_expect),
); );
inventory.replace_loadout_item( inventory.replace_loadout_item(
EquipSlot::ActiveOffhand, EquipSlot::ActiveOffhand,
offhand.map(|specifier| Item::new_from_asset_expect(specifier)), offhand.map(Item::new_from_asset_expect),
); );
} }
}, },

View File

@ -381,6 +381,7 @@ pub fn generate_mesh<'a, V: RectRasterableVol<Vox = Block> + ReadVol + Debug + '
let get_color = let get_color =
|_: &mut (), pos: Vec3<i32>| flat_get(pos).get_color().unwrap_or_else(Rgb::zero); |_: &mut (), pos: Vec3<i32>| flat_get(pos).get_color().unwrap_or_else(Rgb::zero);
let get_opacity = |_: &mut (), pos: Vec3<i32>| !flat_get(pos).is_opaque(); let get_opacity = |_: &mut (), pos: Vec3<i32>| !flat_get(pos).is_opaque();
#[allow(clippy::redundant_closure)]
let flat_get = |pos| flat_get(pos); let flat_get = |pos| flat_get(pos);
let should_draw = |_: &mut (), pos: Vec3<i32>, delta: Vec3<i32>, _uv| { let should_draw = |_: &mut (), pos: Vec3<i32>, delta: Vec3<i32>, _uv| {
should_draw_greedy(pos, delta, flat_get) should_draw_greedy(pos, delta, flat_get)

View File

@ -393,7 +393,7 @@ impl<'frame> Drawer<'frame> {
); );
self.borrow.egui_render_pass.execute( self.borrow.egui_render_pass.execute(
&mut self.encoder.as_mut().unwrap(), self.encoder.as_mut().unwrap(),
self.taking_screenshot self.taking_screenshot
.as_ref() .as_ref()
.map_or(&self.swap_tex.view, |s| s.texture_view()), .map_or(&self.swap_tex.view, |s| s.texture_view()),

View File

@ -415,8 +415,8 @@ fn create_ingame_and_shadow_pipelines(
clouds_task, clouds_task,
bloom_task, bloom_task,
postprocess_task, postprocess_task,
// TODO: if these are ever actually optionally done, counting them // TODO: if these are ever actually optionally done, counting them
// as tasks to do beforehand seems kind of iffy since they will just // as tasks to do beforehand seems kind of iffy since they will just
// be skipped // be skipped
point_shadow_task, point_shadow_task,
terrain_directed_shadow_task, terrain_directed_shadow_task,

View File

@ -111,9 +111,9 @@ impl SessionState {
#[cfg(not(target_os = "macos"))] #[cfg(not(target_os = "macos"))]
if let Some(uid) = client.uid() { if let Some(uid) = client.uid() {
let identiy = if let Some(info) = client.player_list().get(&uid) { let identiy = if let Some(info) = client.player_list().get(&uid) {
format!("{}-{}", info.player_alias, uid.to_string()) format!("{}-{}", info.player_alias, uid)
} else { } else {
format!("unknown-{}", uid.to_string()) format!("unknown-{}", uid)
}; };
mumble_link.set_identity(&identiy); mumble_link.set_identity(&identiy);
// TODO: evaluate context // TODO: evaluate context
@ -285,11 +285,7 @@ impl SessionState {
client::Event::Kicked(reason) => { client::Event::Kicked(reason) => {
global_state.info_message = Some(format!( global_state.info_message = Some(format!(
"{}: {}", "{}: {}",
global_state global_state.i18n.read().get("main.login.kicked"),
.i18n
.read()
.get("main.login.kicked")
.to_string(),
reason reason
)); ));
return Ok(TickAction::Disconnect); return Ok(TickAction::Disconnect);
@ -842,7 +838,7 @@ impl PlayState for SessionState {
}, },
_ => {}, _ => {},
} }
} },
Event::AnalogGameInput(input) => match input { Event::AnalogGameInput(input) => match input {
AnalogGameInput::MovementX(v) => { AnalogGameInput::MovementX(v) => {
self.key_state.analog_matrix.x = v; self.key_state.analog_matrix.x = v;
@ -1502,7 +1498,7 @@ impl PlayState for SessionState {
/// Render the session to the screen. /// Render the session to the screen.
/// ///
/// This method should be called once per frame. /// This method should be called once per frame.
fn render<'a>(&'a self, mut drawer: &mut Drawer<'a>, settings: &Settings) { fn render<'a>(&'a self, drawer: &mut Drawer<'a>, settings: &Settings) {
span!(_guard, "render", "<Session as PlayState>::render"); span!(_guard, "render", "<Session as PlayState>::render");
// Render world // Render world
@ -1529,7 +1525,7 @@ impl PlayState for SessionState {
}; };
self.scene.render( self.scene.render(
&mut drawer, drawer,
client.state(), client.state(),
client.entity(), client.entity(),
client.get_tick(), client.get_tick(),

View File

@ -317,7 +317,7 @@ where
if *id == widget && !filled => if *id == widget && !filled =>
{ {
self.state = ManagerState::Idle; self.state = ManagerState::Idle;
} },
_ => (), _ => (),
} }

View File

@ -35,6 +35,7 @@ static QUIRKY_RAND: RandomPerm = RandomPerm::new(0xA634460F);
pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) { pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) {
// TODO: Get rid of this // TODO: Get rid of this
#[allow(clippy::large_enum_variant)]
enum TreeModel { enum TreeModel {
Structure(Structure), Structure(Structure),
Procedural(ProceduralTree, StructureBlock), Procedural(ProceduralTree, StructureBlock),

View File

@ -7,7 +7,12 @@
)] )]
#![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(bool_to_option, const_panic, label_break_value, option_zip)] #![feature(
bool_to_option,
label_break_value,
option_zip,
arbitrary_enum_discriminant
)]
mod all; mod all;
mod block; mod block;

View File

@ -1750,7 +1750,10 @@ pub(crate) fn fill_sinks<F: Float + Send + Sync>(
let range = 0..map_size_lg.chunks_len(); let range = 0..map_size_lg.chunks_len();
let oldh = range let oldh = range
.into_par_iter() .into_par_iter()
.map(|posi| h(posi)) .map(
#[allow(clippy::redundant_closure)]
|posi| h(posi),
)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();
let mut newh = oldh let mut newh = oldh
@ -2574,7 +2577,10 @@ pub fn do_erosion(
// Stream power law slope exponent--link between channel slope and erosion rate. // Stream power law slope exponent--link between channel slope and erosion rate.
let n = (0..map_size_lg.chunks_len()) let n = (0..map_size_lg.chunks_len())
.into_par_iter() .into_par_iter()
.map(|posi| n(posi)) .map(
#[allow(clippy::redundant_closure)]
|posi| n(posi),
)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();
// Stream power law concavity index (θ = m/n), turned into an exponent on // Stream power law concavity index (θ = m/n), turned into an exponent on
@ -2587,29 +2593,44 @@ pub fn do_erosion(
// Stream power law erodability constant for fluvial erosion (bedrock) // Stream power law erodability constant for fluvial erosion (bedrock)
let kf = (0..map_size_lg.chunks_len()) let kf = (0..map_size_lg.chunks_len())
.into_par_iter() .into_par_iter()
.map(|posi| kf(posi)) .map(
#[allow(clippy::redundant_closure)]
|posi| kf(posi),
)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();
// Stream power law erodability constant for hillslope diffusion (bedrock) // Stream power law erodability constant for hillslope diffusion (bedrock)
let kd = (0..map_size_lg.chunks_len()) let kd = (0..map_size_lg.chunks_len())
.into_par_iter() .into_par_iter()
.map(|posi| kd(posi)) .map(
#[allow(clippy::redundant_closure)]
|posi| kd(posi),
)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();
// Deposition coefficient // Deposition coefficient
let g = (0..map_size_lg.chunks_len()) let g = (0..map_size_lg.chunks_len())
.into_par_iter() .into_par_iter()
.map(|posi| g(posi)) .map(
#[allow(clippy::redundant_closure)]
|posi| g(posi),
)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();
let epsilon_0 = (0..map_size_lg.chunks_len()) let epsilon_0 = (0..map_size_lg.chunks_len())
.into_par_iter() .into_par_iter()
.map(|posi| epsilon_0(posi)) .map(
#[allow(clippy::redundant_closure)]
|posi| epsilon_0(posi),
)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();
let alpha = (0..map_size_lg.chunks_len()) let alpha = (0..map_size_lg.chunks_len())
.into_par_iter() .into_par_iter()
.map(|posi| alpha(posi)) .map(
#[allow(clippy::redundant_closure)]
|posi| alpha(posi),
)
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into_boxed_slice(); .into_boxed_slice();
let mut wh = vec![0.0; map_size_lg.chunks_len()].into_boxed_slice(); let mut wh = vec![0.0; map_size_lg.chunks_len()].into_boxed_slice();
@ -2655,8 +2676,13 @@ pub fn do_erosion(
let g = |posi: usize| g[posi]; let g = |posi: usize| g[posi];
let epsilon_0 = |posi: usize| epsilon_0[posi]; let epsilon_0 = |posi: usize| epsilon_0[posi];
let alpha = |posi: usize| alpha[posi]; let alpha = |posi: usize| alpha[posi];
#[allow(clippy::redundant_closure)]
let height_scale = |n| height_scale(n); let height_scale = |n| height_scale(n);
#[allow(clippy::redundant_closure)]
let k_da_scale = |q| k_da_scale(q); let k_da_scale = |q| k_da_scale(q);
#[allow(clippy::redundant_closure)]
let is_ocean = |posi| is_ocean(posi);
(0..n_steps).for_each(|i| { (0..n_steps).for_each(|i| {
debug!("Erosion iteration #{:?}", i); debug!("Erosion iteration #{:?}", i);
erode( erode(
@ -2677,7 +2703,7 @@ pub fn do_erosion(
g, g,
epsilon_0, epsilon_0,
alpha, alpha,
|posi| is_ocean(posi), is_ocean,
height_scale, height_scale,
k_da_scale, k_da_scale,
threadpool, threadpool,

View File

@ -624,7 +624,7 @@ impl WorldSim {
// //
// Based on this estimate, we have: // Based on this estimate, we have:
// delta_t_scale ≡ (Δt / Δt') = time_scale // delta_t_scale ≡ (Δt / Δt') = time_scale
let delta_t_scale = |n: f32| time_scale(n); let delta_t_scale = time_scale;
// alpha_scale ≡ (α / α') = height_scale^(-1) // alpha_scale ≡ (α / α') = height_scale^(-1)
let alpha_scale = |n: f32| height_scale(n).recip() as f32; let alpha_scale = |n: f32| height_scale(n).recip() as f32;
// //

View File

@ -826,7 +826,7 @@ pub fn tick_site_economy(
site.economy.marginal_surplus = demand.map(|g, demand| supply[g] - demand); site.economy.marginal_surplus = demand.map(|g, demand| supply[g] - demand);
// plan trading with other sites // plan trading with other sites
let mut external_orders = &mut index.trade.orders; let external_orders = &mut index.trade.orders;
let mut potential_trade = GoodMap::from_default(0.0); let mut potential_trade = GoodMap::from_default(0.0);
// use last year's generated transportation for merchants (could we do better? // use last year's generated transportation for merchants (could we do better?
// this is in line with the other professions) // this is in line with the other professions)
@ -836,7 +836,7 @@ pub fn tick_site_economy(
site, site,
&site_id, &site_id,
transportation_capacity, transportation_capacity,
&mut external_orders, external_orders,
&mut potential_trade, &mut potential_trade,
); );
site.economy.active_exports = GoodMap::from_iter(trade.iter().map(|(g, a)| (g, -*a)), 0.0); // TODO: check for availability? site.economy.active_exports = GoodMap::from_iter(trade.iter().map(|(g, a)| (g, -*a)), 0.0); // TODO: check for availability?

View File

@ -106,25 +106,25 @@ impl TileGrid {
{ {
aabr.max.x += 1; aabr.max.x += 1;
last_growth = i; last_growth = i;
} },
1 if (aabr.min.x..aabr.max.x + 1) 1 if (aabr.min.x..aabr.max.x + 1)
.all(|x| self.get(Vec2::new(x, aabr.max.y)).is_empty()) => .all(|x| self.get(Vec2::new(x, aabr.max.y)).is_empty()) =>
{ {
aabr.max.y += 1; aabr.max.y += 1;
last_growth = i; last_growth = i;
} },
2 if (aabr.min.y..aabr.max.y + 1) 2 if (aabr.min.y..aabr.max.y + 1)
.all(|y| self.get(Vec2::new(aabr.min.x - 1, y)).is_empty()) => .all(|y| self.get(Vec2::new(aabr.min.x - 1, y)).is_empty()) =>
{ {
aabr.min.x -= 1; aabr.min.x -= 1;
last_growth = i; last_growth = i;
} },
3 if (aabr.min.x..aabr.max.x + 1) 3 if (aabr.min.x..aabr.max.x + 1)
.all(|x| self.get(Vec2::new(x, aabr.min.y - 1)).is_empty()) => .all(|x| self.get(Vec2::new(x, aabr.min.y - 1)).is_empty()) =>
{ {
aabr.min.y -= 1; aabr.min.y -= 1;
last_growth = i; last_growth = i;
} },
_ => {}, _ => {},
} }
} }