update tag and fix empty maps, other bugs introduced by auto fix

This commit is contained in:
Marcel Märtens 2022-11-28 23:51:03 +01:00
parent 2812729b78
commit 225cbf472f
10 changed files with 15 additions and 22 deletions

View File

@ -13,7 +13,7 @@ variables:
# https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning
GIT_DEPTH: 3
GIT_CLEAN_FLAGS: -f
CACHE_IMAGE_TAG: 9a0cb110
CACHE_IMAGE_TAG: 8e8fe241
TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/'
default:

View File

@ -992,12 +992,10 @@ impl Client {
&mut self,
view_distances: common::ViewDistances,
) -> common::ViewDistances {
#[allow(clippy::manual_clamp)]
let view_distances = common::ViewDistances {
terrain: view_distances
.terrain
.max(1)
.min(MAX_SELECTABLE_VIEW_DISTANCE),
.clamp(1, MAX_SELECTABLE_VIEW_DISTANCE),
entity: view_distances.entity.max(1),
};
self.view_distance = Some(view_distances.terrain);

View File

@ -15,12 +15,11 @@ impl ViewDistances {
/// entity view distance to the resulting terrain view distance.
///
/// Also ensures both are at a minimum of 1 (unless the provided max is 0).
#[allow(clippy::manual_clamp)]
pub fn clamp(self, max: Option<u32>) -> Self {
let terrain = self.terrain.max(1).min(max.unwrap_or(u32::MAX));
let terrain = self.terrain.clamp(1,max.unwrap_or(u32::MAX));
Self {
terrain,
entity: self.entity.max(1).min(terrain),
entity: self.entity.clamp(1,terrain),
}
}
}

View File

@ -80,7 +80,7 @@ impl ViewDistance {
pub fn new(start_value: u32, now: Instant) -> Self {
Self {
direction: Direction::Up,
last_direction_change_time: now.checked_sub(Self::TIME_PER_DIR_CHANGE).unwrap(),
last_direction_change_time: now.checked_sub(Self::TIME_PER_DIR_CHANGE).unwrap_or(now),
target: None,
current: start_value,
}

View File

@ -1204,7 +1204,7 @@ impl<'a> Widget for Map<'a> {
let side_length = 20.0 * factor;
let (rpos, fade) = match wpos_to_rpos_fade(
member_pos.0.xy().map(|e| e),
member_pos.0.xy(),
Vec2::from(side_length / 2.0),
side_length / 2.0,
) {
@ -1232,7 +1232,7 @@ impl<'a> Widget for Map<'a> {
handle_widget_mouse_events(
state.ids.member_indicators[i],
MarkerChange::Pos(member_pos.0.xy().map(|e| e)),
MarkerChange::Pos(member_pos.0.xy()),
ui,
&mut events,
state.ids.map_layers[0],

View File

@ -769,7 +769,7 @@ impl<'a> Widget for MiniMap<'a> {
let member_pos = entity.and_then(|entity| member_pos.get(entity));
if let Some(member_pos) = member_pos {
let rpos = match wpos_to_rpos(member_pos.0.xy().map(|e| e), false) {
let rpos = match wpos_to_rpos(member_pos.0.xy(), false) {
Some(rpos) => rpos,
None => continue,
};

View File

@ -168,7 +168,7 @@ impl<'a> Canvas<'a> {
) {
let chunk_aabr = Aabr {
min: self.wpos(),
max: self.wpos() + Vec2::from(self.area().size().map(|e| e)),
max: self.wpos() + Vec2::from(self.area().size()),
};
for y in chunk_aabr.min.y.max(aabr.min.y)..chunk_aabr.max.y.min(aabr.max.y) {

View File

@ -262,10 +262,8 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
Some(RiverKind::Lake { .. } | RiverKind::Ocean)
) {
let water_chunk = posj.map(|e| e as f64);
let lake_width_noise = sim
.gen_ctx
.small_nz
.get((wposf.map(|e| e).div(32.0)).into_array());
let lake_width_noise =
sim.gen_ctx.small_nz.get((wposf.div(32.0)).into_array());
let water_aabr = Aabr {
min: water_chunk * neighbor_coef + 4.0 - lake_width_noise * 8.0,
max: (water_chunk + 1.0) * neighbor_coef - 4.0
@ -313,10 +311,8 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
},
RiverKind::Ocean => {
let water_chunk = posj.map(|e| e as f64);
let lake_width_noise = sim
.gen_ctx
.small_nz
.get((wposf.map(|e| e).div(32.0)).into_array());
let lake_width_noise =
sim.gen_ctx.small_nz.get((wposf.div(32.0)).into_array());
let water_aabr = Aabr {
min: water_chunk * neighbor_coef + 4.0 - lake_width_noise * 8.0,
max: (water_chunk + 1.0) * neighbor_coef - 4.0 + lake_width_noise * 8.0,

View File

@ -499,7 +499,7 @@ fn write_column<R: Rng>(
.mul(0.1)
.clamped(0.0, 1.0);
let rpos = wposf_warped - mushroom.pos.map(|e| e as f32).map(|e| e);
let rpos = wposf_warped - mushroom.pos.map(|e| e as f32);
let stalk_radius = 2.5f32;
let head_radius = 12.0f32;

View File

@ -887,7 +887,7 @@ pub fn apply_caverns_to<R: Rng>(canvas: &mut Canvas, dynamic_rng: &mut R) {
.mul(0.1)
.clamped(0.0, 1.0);
let rpos = wposf_warped - mushroom.pos.map(|e| e as f32).map(|e| e);
let rpos = wposf_warped - mushroom.pos.map(|e| e as f32);
let stalk_radius = 2.5f32;
let head_radius = 18.0f32;