mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xMAC94x/update-toolchain' into 'master'
xMAC94x/update toolchain See merge request veloren/veloren!3027
This commit is contained in:
commit
3fa2dab3aa
@ -13,7 +13,7 @@ variables:
|
||||
# https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning
|
||||
GIT_DEPTH: 3
|
||||
GIT_CLEAN_FLAGS: -f
|
||||
CACHE_IMAGE_TAG: f4db383e
|
||||
CACHE_IMAGE_TAG: a4f7c998
|
||||
|
||||
default:
|
||||
# https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines
|
||||
|
@ -93,7 +93,7 @@ impl Tui {
|
||||
if [HelpDisplayed, MissingRequiredArgument, UnknownArgument].contains(&e.kind) =>
|
||||
{
|
||||
println!("{}", e.message);
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
error!("{:?}", e);
|
||||
return false;
|
||||
|
@ -84,7 +84,7 @@ where
|
||||
let filter = match std::env::var_os(RUST_LOG_ENV).map(|s| s.into_string()) {
|
||||
Some(Ok(env)) => {
|
||||
let mut filter = base_exceptions(EnvFilter::new(""));
|
||||
for s in env.split(',').into_iter() {
|
||||
for s in env.split(',') {
|
||||
match s.parse() {
|
||||
Ok(d) => filter = filter.add_directive(d),
|
||||
Err(err) => println!("WARN ignoring log directive: `{}`: {}", s, err),
|
||||
|
@ -171,7 +171,7 @@ impl Attack {
|
||||
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(
|
||||
&self,
|
||||
attacker: Option<AttackerInfo>,
|
||||
|
@ -779,7 +779,7 @@ impl Item {
|
||||
|
||||
/// Returns an iterator that drains items contained within the item's slots
|
||||
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 }
|
||||
|
@ -94,9 +94,12 @@ impl ItemSpec {
|
||||
match self {
|
||||
ItemSpec::Item(specifier) => {
|
||||
let item = Item::new_from_asset_expect(specifier);
|
||||
if !equip_slot.can_hold(&item.kind) {
|
||||
panic!("Tried to place {} into {:?}", specifier, equip_slot);
|
||||
}
|
||||
assert!(
|
||||
equip_slot.can_hold(&item.kind),
|
||||
"Tried to place {} into {:?}",
|
||||
specifier,
|
||||
equip_slot
|
||||
);
|
||||
std::mem::drop(item);
|
||||
},
|
||||
ItemSpec::Choice(items) => {
|
||||
|
@ -121,7 +121,7 @@ impl Inventory {
|
||||
/// Sorts the inventory using the next sort order
|
||||
pub fn sort(&mut self) {
|
||||
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 {
|
||||
InventorySortOrder::Name => Ord::cmp(a.name(), b.name()),
|
||||
|
@ -11,7 +11,8 @@
|
||||
option_zip,
|
||||
trait_alias,
|
||||
type_alias_impl_trait,
|
||||
extend_one
|
||||
extend_one,
|
||||
arbitrary_enum_discriminant
|
||||
)]
|
||||
#![feature(hash_drain_filter)]
|
||||
|
||||
|
@ -170,7 +170,7 @@ pub fn try_salvage(
|
||||
let salvage_item = inv.get(slot).expect("Expected item to exist in inventory");
|
||||
let salvage_output: Vec<_> = salvage_item
|
||||
.salvage_output()
|
||||
.map(|asset| Item::new_from_asset_expect(asset))
|
||||
.map(Item::new_from_asset_expect)
|
||||
.collect();
|
||||
if salvage_output.is_empty() {
|
||||
// If no output items, assume salvaging was a failure
|
||||
|
@ -285,8 +285,8 @@ impl SpriteKind {
|
||||
/// What loot table does collecting this sprite draw from?
|
||||
#[inline]
|
||||
pub fn collectible_id(&self) -> Option<LootSpec<&'static str>> {
|
||||
let item = |id: &'static str| LootSpec::Item(id);
|
||||
let table = |id: &'static str| LootSpec::LootTable(id);
|
||||
let item = LootSpec::Item;
|
||||
let table = LootSpec::LootTable;
|
||||
Some(match self {
|
||||
SpriteKind::Apple => item("common.items.food.apple"),
|
||||
SpriteKind::Mushroom => item("common.items.food.mushroom"),
|
||||
|
@ -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_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() {
|
||||
format!("{}-{}", VELOREN_VERSION_STAGE, GIT_DATE.to_string())
|
||||
format!("{}-{}", VELOREN_VERSION_STAGE, *GIT_DATE)
|
||||
} 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() {
|
||||
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_HASH.to_string())
|
||||
format!("{} ({})", DISPLAY_VERSION.as_str(), *GIT_HASH)
|
||||
} else {
|
||||
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION.to_string())
|
||||
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -98,14 +98,14 @@ impl<'a> System<'a> for Sys {
|
||||
entity,
|
||||
uid,
|
||||
mut char_state,
|
||||
mut pos,
|
||||
mut vel,
|
||||
mut ori,
|
||||
pos,
|
||||
vel,
|
||||
ori,
|
||||
mass,
|
||||
mut density,
|
||||
energy,
|
||||
inventory,
|
||||
mut controller,
|
||||
controller,
|
||||
health,
|
||||
body,
|
||||
physics,
|
||||
@ -172,14 +172,14 @@ impl<'a> System<'a> for Sys {
|
||||
entity,
|
||||
uid,
|
||||
char_state,
|
||||
pos: &mut pos,
|
||||
vel: &mut vel,
|
||||
ori: &mut ori,
|
||||
pos,
|
||||
vel,
|
||||
ori,
|
||||
mass,
|
||||
density: &mut density,
|
||||
energy,
|
||||
inventory,
|
||||
controller: &mut controller,
|
||||
controller,
|
||||
health,
|
||||
body,
|
||||
physics,
|
||||
|
@ -355,7 +355,7 @@ impl<'a> PhysicsData<'a> {
|
||||
mass,
|
||||
collider,
|
||||
sticky,
|
||||
mut physics,
|
||||
physics,
|
||||
projectile,
|
||||
char_state_maybe,
|
||||
)| {
|
||||
@ -455,7 +455,7 @@ impl<'a> PhysicsData<'a> {
|
||||
&mut collision_registered,
|
||||
&mut entity_entity_collisions,
|
||||
factor,
|
||||
&mut physics,
|
||||
physics,
|
||||
char_state_maybe,
|
||||
&mut vel_delta,
|
||||
step_delta,
|
||||
@ -830,7 +830,7 @@ impl<'a> PhysicsData<'a> {
|
||||
&mut cpos,
|
||||
tgt_pos,
|
||||
&mut vel,
|
||||
&mut physics_state,
|
||||
physics_state,
|
||||
Vec3::zero(),
|
||||
&read.dt,
|
||||
was_on_ground,
|
||||
@ -862,7 +862,7 @@ impl<'a> PhysicsData<'a> {
|
||||
&mut cpos,
|
||||
tgt_pos,
|
||||
&mut vel,
|
||||
&mut physics_state,
|
||||
physics_state,
|
||||
Vec3::zero(),
|
||||
&read.dt,
|
||||
was_on_ground,
|
||||
|
@ -1 +1 @@
|
||||
nightly-2021-09-24
|
||||
nightly-2021-11-24
|
||||
|
@ -969,7 +969,7 @@ fn handle_time(
|
||||
0,
|
||||
);
|
||||
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"),
|
||||
};
|
||||
server.notify_client(
|
||||
@ -1000,7 +1000,7 @@ fn handle_time(
|
||||
client,
|
||||
ServerGeneral::server_msg(
|
||||
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,
|
||||
format!(
|
||||
"Server is running {}[{}]",
|
||||
common::util::GIT_HASH.to_string(),
|
||||
common::util::GIT_DATE.to_string(),
|
||||
*common::util::GIT_HASH,
|
||||
*common::util::GIT_DATE,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -119,7 +119,7 @@ pub fn handle_process_trade_action(
|
||||
.ecs()
|
||||
.read_component::<Inventory>()
|
||||
.get(e)
|
||||
.map(|i| ReducedInventory::from(i));
|
||||
.map(ReducedInventory::from);
|
||||
// Get price info from the first Agent in the trade (currently, an
|
||||
// Agent will never initiate a trade with another agent though)
|
||||
#[cfg(feature = "worldgen")]
|
||||
|
@ -445,7 +445,7 @@ impl Server {
|
||||
state.ecs_mut().write_resource::<TimeOfDay>().0 = settings.start_time;
|
||||
|
||||
// Register trackers
|
||||
sys::sentinel::register_trackers(&mut state.ecs_mut());
|
||||
sys::sentinel::register_trackers(state.ecs_mut());
|
||||
|
||||
state.ecs_mut().insert(DeletedEntities::default());
|
||||
|
||||
|
@ -481,7 +481,7 @@ pub fn convert_body_from_database(
|
||||
_ => {
|
||||
return Err(PersistenceError::ConversionError(format!(
|
||||
"{} 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| {
|
||||
PersistenceError::AssetError(format!(
|
||||
"Error loading item asset: {} - {}",
|
||||
item_definition_id,
|
||||
err.to_string()
|
||||
item_definition_id, err
|
||||
))
|
||||
})
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
@ -1464,7 +1464,7 @@ impl<'a> AgentData<'a> {
|
||||
{
|
||||
value +=
|
||||
data.strength * data.duration.map_or(0.0, |d| d.as_secs() as f32);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
let mut finished_pending = 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()
|
||||
{
|
||||
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(
|
||||
&mut pending,
|
||||
pending,
|
||||
#[cfg(feature = "plugins")]
|
||||
&ecs_world,
|
||||
#[cfg(feature = "plugins")]
|
||||
|
@ -378,6 +378,8 @@ impl<'a> System<'a> for Sys {
|
||||
/// Convinient structure to use when you need to create new npc
|
||||
/// from EntityInfo
|
||||
// TODO: better name?
|
||||
// TODO: if this is send around network, optimize the large_enum_variant
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum NpcData {
|
||||
Data {
|
||||
pos: Pos,
|
||||
|
@ -386,7 +386,7 @@ impl<'a> InventoryScroller<'a> {
|
||||
if self.show_salvage && item.is_salvageable() {
|
||||
let salvage_result: Vec<_> = item
|
||||
.salvage_output()
|
||||
.map(|asset| Arc::<ItemDef>::load_expect_cloned(asset))
|
||||
.map(Arc::<ItemDef>::load_expect_cloned)
|
||||
.map(|item| item as Arc<dyn ItemDesc>)
|
||||
.collect();
|
||||
|
||||
|
@ -343,7 +343,7 @@ impl<'a> Widget for Chat<'a> {
|
||||
// Chat input uses a rectangle as its background.
|
||||
if input_focused {
|
||||
// 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) {
|
||||
state.update(|s| {
|
||||
s.input.mode = self.client.chat_mode.clone();
|
||||
|
@ -2348,15 +2348,12 @@ impl Hud {
|
||||
(time_in_seconds as u64 % 86400) as u32,
|
||||
0,
|
||||
);
|
||||
Text::new(&format!(
|
||||
"Time: {}",
|
||||
current_time.format("%H:%M").to_string()
|
||||
))
|
||||
.color(TEXT_COLOR)
|
||||
.down_from(self.ids.loaded_distance, V_PAD)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.set(self.ids.time, ui_widgets);
|
||||
Text::new(&format!("Time: {}", current_time.format("%H:%M")))
|
||||
.color(TEXT_COLOR)
|
||||
.down_from(self.ids.loaded_distance, V_PAD)
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.set(self.ids.time, ui_widgets);
|
||||
|
||||
// Number of entities
|
||||
let entity_count = client.state().ecs().entities().join().count();
|
||||
@ -3875,7 +3872,7 @@ impl Hud {
|
||||
// thread pool
|
||||
let _pool = client.state().ecs().read_resource::<SlowJobPool>();
|
||||
self.ui.maintain(
|
||||
&mut global_state.window.renderer_mut(),
|
||||
global_state.window.renderer_mut(),
|
||||
None,
|
||||
//Some(&pool),
|
||||
Some(proj_mat * view_mat * Mat4::translation_3d(-focus_off)),
|
||||
|
@ -148,12 +148,12 @@ impl<'a> Ingameable for Overhead<'a> {
|
||||
} else {
|
||||
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 }
|
||||
} else {
|
||||
0
|
||||
}
|
||||
+ if info.health.map_or(false, |h| decayed_health_displayed(h)) {
|
||||
+ if info.health.map_or(false, decayed_health_displayed) {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
@ -446,7 +446,7 @@ impl<'a> Widget for Overhead<'a> {
|
||||
.parent(id)
|
||||
.set(state.ids.level, ui);
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ impl<'a> Skillbar<'a> {
|
||||
.abilities
|
||||
.get(i)
|
||||
.and_then(|a| Ability::from(*a).ability_id(Some(inventory)))
|
||||
.map(|id| util::ability_description(id)),
|
||||
.map(util::ability_description),
|
||||
})
|
||||
};
|
||||
|
||||
|
@ -256,7 +256,7 @@ impl<'a> Widget for Social<'a> {
|
||||
None => format!(
|
||||
"{} [{}]",
|
||||
alias.clone(),
|
||||
self.localized_strings.get("hud.group.in_menu").to_string()
|
||||
self.localized_strings.get("hud.group.in_menu")
|
||||
), // character select or spectating
|
||||
};
|
||||
let acc_name_txt = format!(
|
||||
|
@ -546,7 +546,7 @@ impl<'a> Widget for Trade<'a> {
|
||||
|
||||
fn update(mut self, args: widget::UpdateArgs<Self>) -> Self::Event {
|
||||
common_base::prof_span!("Trade::update");
|
||||
let widget::UpdateArgs { mut state, ui, .. } = args;
|
||||
let widget::UpdateArgs { state, ui, .. } = args;
|
||||
|
||||
let mut event = None;
|
||||
let (trade, prices) = match self.client.pending_trade() {
|
||||
@ -572,18 +572,14 @@ impl<'a> Widget for Trade<'a> {
|
||||
});
|
||||
}
|
||||
|
||||
self.background(&mut state, ui);
|
||||
self.title(&mut state, ui);
|
||||
self.phase_indicator(&mut state, ui, trade);
|
||||
self.background(state, ui);
|
||||
self.title(state, ui);
|
||||
self.phase_indicator(state, ui, trade);
|
||||
|
||||
event = self
|
||||
.item_pane(&mut state, ui, trade, prices, false)
|
||||
.or(event);
|
||||
event = self
|
||||
.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 = self.item_pane(state, ui, trade, prices, false).or(event);
|
||||
event = self.item_pane(state, ui, trade, prices, true).or(event);
|
||||
event = self.accept_decline_buttons(state, ui, trade).or(event);
|
||||
event = self.close_button(state, ui).or(event);
|
||||
|
||||
event
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ fn main() {
|
||||
logs_dir.join(&log_filename).display(),
|
||||
reason,
|
||||
panic_info,
|
||||
common::util::GIT_HASH.to_string(),
|
||||
common::util::GIT_DATE.to_string()
|
||||
*common::util::GIT_HASH,
|
||||
*common::util::GIT_DATE
|
||||
);
|
||||
|
||||
error!(
|
||||
|
@ -812,8 +812,14 @@ impl Controls {
|
||||
};
|
||||
|
||||
// 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] =
|
||||
species_buttons;
|
||||
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,
|
||||
] = species_buttons;
|
||||
let species = Column::with_children(vec![
|
||||
Row::with_children(vec![
|
||||
icon_button_tooltip(
|
||||
@ -874,8 +880,14 @@ impl Controls {
|
||||
])
|
||||
.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] =
|
||||
tool_buttons;
|
||||
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,
|
||||
] = tool_buttons;
|
||||
let tool = Column::with_children(vec![
|
||||
Row::with_children(vec![
|
||||
icon_button_tooltip(
|
||||
@ -1245,7 +1257,7 @@ impl Controls {
|
||||
i18n.get("main.login.server_version"),
|
||||
mismatched_version,
|
||||
i18n.get("main.login.client_version"),
|
||||
common::util::GIT_HASH.to_string()
|
||||
*common::util::GIT_HASH
|
||||
))
|
||||
.size(self.fonts.cyri.scale(18))
|
||||
.color(iced::Color::from_rgb(1.0, 0.0, 0.0))
|
||||
@ -1356,11 +1368,11 @@ impl Controls {
|
||||
*offhand = value.1;
|
||||
inventory.replace_loadout_item(
|
||||
EquipSlot::ActiveMainhand,
|
||||
mainhand.map(|specifier| Item::new_from_asset_expect(specifier)),
|
||||
mainhand.map(Item::new_from_asset_expect),
|
||||
);
|
||||
inventory.replace_loadout_item(
|
||||
EquipSlot::ActiveOffhand,
|
||||
offhand.map(|specifier| Item::new_from_asset_expect(specifier)),
|
||||
offhand.map(Item::new_from_asset_expect),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
@ -381,6 +381,7 @@ pub fn generate_mesh<'a, V: RectRasterableVol<Vox = Block> + ReadVol + Debug + '
|
||||
let get_color =
|
||||
|_: &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();
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let flat_get = |pos| flat_get(pos);
|
||||
let should_draw = |_: &mut (), pos: Vec3<i32>, delta: Vec3<i32>, _uv| {
|
||||
should_draw_greedy(pos, delta, flat_get)
|
||||
|
@ -393,7 +393,7 @@ impl<'frame> Drawer<'frame> {
|
||||
);
|
||||
|
||||
self.borrow.egui_render_pass.execute(
|
||||
&mut self.encoder.as_mut().unwrap(),
|
||||
self.encoder.as_mut().unwrap(),
|
||||
self.taking_screenshot
|
||||
.as_ref()
|
||||
.map_or(&self.swap_tex.view, |s| s.texture_view()),
|
||||
|
@ -415,8 +415,8 @@ fn create_ingame_and_shadow_pipelines(
|
||||
clouds_task,
|
||||
bloom_task,
|
||||
postprocess_task,
|
||||
// TODO: if these are ever actually optionally done, counting them
|
||||
// as tasks to do beforehand seems kind of iffy since they will just
|
||||
// TODO: if these are ever actually optionally done, counting them
|
||||
// as tasks to do beforehand seems kind of iffy since they will just
|
||||
// be skipped
|
||||
point_shadow_task,
|
||||
terrain_directed_shadow_task,
|
||||
|
@ -111,9 +111,9 @@ impl SessionState {
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
if let Some(uid) = client.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 {
|
||||
format!("unknown-{}", uid.to_string())
|
||||
format!("unknown-{}", uid)
|
||||
};
|
||||
mumble_link.set_identity(&identiy);
|
||||
// TODO: evaluate context
|
||||
@ -285,11 +285,7 @@ impl SessionState {
|
||||
client::Event::Kicked(reason) => {
|
||||
global_state.info_message = Some(format!(
|
||||
"{}: {}",
|
||||
global_state
|
||||
.i18n
|
||||
.read()
|
||||
.get("main.login.kicked")
|
||||
.to_string(),
|
||||
global_state.i18n.read().get("main.login.kicked"),
|
||||
reason
|
||||
));
|
||||
return Ok(TickAction::Disconnect);
|
||||
@ -842,7 +838,7 @@ impl PlayState for SessionState {
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
},
|
||||
Event::AnalogGameInput(input) => match input {
|
||||
AnalogGameInput::MovementX(v) => {
|
||||
self.key_state.analog_matrix.x = v;
|
||||
@ -1502,7 +1498,7 @@ impl PlayState for SessionState {
|
||||
/// Render the session to the screen.
|
||||
///
|
||||
/// 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");
|
||||
|
||||
// Render world
|
||||
@ -1529,7 +1525,7 @@ impl PlayState for SessionState {
|
||||
};
|
||||
|
||||
self.scene.render(
|
||||
&mut drawer,
|
||||
drawer,
|
||||
client.state(),
|
||||
client.entity(),
|
||||
client.get_tick(),
|
||||
|
@ -317,7 +317,7 @@ where
|
||||
if *id == widget && !filled =>
|
||||
{
|
||||
self.state = ManagerState::Idle;
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ static QUIRKY_RAND: RandomPerm = RandomPerm::new(0xA634460F);
|
||||
|
||||
pub fn apply_trees_to(canvas: &mut Canvas, dynamic_rng: &mut impl Rng) {
|
||||
// TODO: Get rid of this
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum TreeModel {
|
||||
Structure(Structure),
|
||||
Procedural(ProceduralTree, StructureBlock),
|
||||
|
@ -7,7 +7,12 @@
|
||||
)]
|
||||
#![allow(clippy::branches_sharing_code)] // TODO: evaluate
|
||||
#![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 block;
|
||||
|
@ -1750,7 +1750,10 @@ pub(crate) fn fill_sinks<F: Float + Send + Sync>(
|
||||
let range = 0..map_size_lg.chunks_len();
|
||||
let oldh = range
|
||||
.into_par_iter()
|
||||
.map(|posi| h(posi))
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| h(posi),
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
let mut newh = oldh
|
||||
@ -2574,7 +2577,10 @@ pub fn do_erosion(
|
||||
// Stream power law slope exponent--link between channel slope and erosion rate.
|
||||
let n = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(|posi| n(posi))
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| n(posi),
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
// 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)
|
||||
let kf = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(|posi| kf(posi))
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| kf(posi),
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
// Stream power law erodability constant for hillslope diffusion (bedrock)
|
||||
let kd = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(|posi| kd(posi))
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| kd(posi),
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
// Deposition coefficient
|
||||
let g = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(|posi| g(posi))
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| g(posi),
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
let epsilon_0 = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(|posi| epsilon_0(posi))
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| epsilon_0(posi),
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
.into_boxed_slice();
|
||||
let alpha = (0..map_size_lg.chunks_len())
|
||||
.into_par_iter()
|
||||
.map(|posi| alpha(posi))
|
||||
.map(
|
||||
#[allow(clippy::redundant_closure)]
|
||||
|posi| alpha(posi),
|
||||
)
|
||||
.collect::<Vec<_>>()
|
||||
.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 epsilon_0 = |posi: usize| epsilon_0[posi];
|
||||
let alpha = |posi: usize| alpha[posi];
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let height_scale = |n| height_scale(n);
|
||||
#[allow(clippy::redundant_closure)]
|
||||
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| {
|
||||
debug!("Erosion iteration #{:?}", i);
|
||||
erode(
|
||||
@ -2677,7 +2703,7 @@ pub fn do_erosion(
|
||||
g,
|
||||
epsilon_0,
|
||||
alpha,
|
||||
|posi| is_ocean(posi),
|
||||
is_ocean,
|
||||
height_scale,
|
||||
k_da_scale,
|
||||
threadpool,
|
||||
|
@ -624,7 +624,7 @@ impl WorldSim {
|
||||
//
|
||||
// Based on this estimate, we have:
|
||||
// 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)
|
||||
let alpha_scale = |n: f32| height_scale(n).recip() as f32;
|
||||
//
|
||||
|
@ -826,7 +826,7 @@ pub fn tick_site_economy(
|
||||
site.economy.marginal_surplus = demand.map(|g, demand| supply[g] - demand);
|
||||
|
||||
// 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);
|
||||
// use last year's generated transportation for merchants (could we do better?
|
||||
// this is in line with the other professions)
|
||||
@ -836,7 +836,7 @@ pub fn tick_site_economy(
|
||||
site,
|
||||
&site_id,
|
||||
transportation_capacity,
|
||||
&mut external_orders,
|
||||
external_orders,
|
||||
&mut potential_trade,
|
||||
);
|
||||
site.economy.active_exports = GoodMap::from_iter(trade.iter().map(|(g, a)| (g, -*a)), 0.0); // TODO: check for availability?
|
||||
|
@ -106,25 +106,25 @@ impl TileGrid {
|
||||
{
|
||||
aabr.max.x += 1;
|
||||
last_growth = i;
|
||||
}
|
||||
},
|
||||
1 if (aabr.min.x..aabr.max.x + 1)
|
||||
.all(|x| self.get(Vec2::new(x, aabr.max.y)).is_empty()) =>
|
||||
{
|
||||
aabr.max.y += 1;
|
||||
last_growth = i;
|
||||
}
|
||||
},
|
||||
2 if (aabr.min.y..aabr.max.y + 1)
|
||||
.all(|y| self.get(Vec2::new(aabr.min.x - 1, y)).is_empty()) =>
|
||||
{
|
||||
aabr.min.x -= 1;
|
||||
last_growth = i;
|
||||
}
|
||||
},
|
||||
3 if (aabr.min.x..aabr.max.x + 1)
|
||||
.all(|x| self.get(Vec2::new(x, aabr.min.y - 1)).is_empty()) =>
|
||||
{
|
||||
aabr.min.y -= 1;
|
||||
last_growth = i;
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user