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 # 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: 9a0cb110 CACHE_IMAGE_TAG: 8e8fe241
TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/' TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/'
default: default:

View File

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

View File

@ -15,12 +15,11 @@ impl ViewDistances {
/// entity view distance to the resulting terrain view distance. /// entity view distance to the resulting terrain view distance.
/// ///
/// Also ensures both are at a minimum of 1 (unless the provided max is 0). /// 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 { 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 { Self {
terrain, 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 { pub fn new(start_value: u32, now: Instant) -> Self {
Self { Self {
direction: Direction::Up, 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, target: None,
current: start_value, current: start_value,
} }

View File

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

View File

@ -168,7 +168,7 @@ impl<'a> Canvas<'a> {
) { ) {
let chunk_aabr = Aabr { let chunk_aabr = Aabr {
min: self.wpos(), 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) { 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) Some(RiverKind::Lake { .. } | RiverKind::Ocean)
) { ) {
let water_chunk = posj.map(|e| e as f64); let water_chunk = posj.map(|e| e as f64);
let lake_width_noise = sim let lake_width_noise =
.gen_ctx sim.gen_ctx.small_nz.get((wposf.div(32.0)).into_array());
.small_nz
.get((wposf.map(|e| e).div(32.0)).into_array());
let water_aabr = Aabr { let water_aabr = Aabr {
min: water_chunk * neighbor_coef + 4.0 - lake_width_noise * 8.0, min: water_chunk * neighbor_coef + 4.0 - lake_width_noise * 8.0,
max: (water_chunk + 1.0) * neighbor_coef - 4.0 max: (water_chunk + 1.0) * neighbor_coef - 4.0
@ -313,10 +311,8 @@ impl<'a> Sampler<'a> for ColumnGen<'a> {
}, },
RiverKind::Ocean => { RiverKind::Ocean => {
let water_chunk = posj.map(|e| e as f64); let water_chunk = posj.map(|e| e as f64);
let lake_width_noise = sim let lake_width_noise =
.gen_ctx sim.gen_ctx.small_nz.get((wposf.div(32.0)).into_array());
.small_nz
.get((wposf.map(|e| e).div(32.0)).into_array());
let water_aabr = Aabr { let water_aabr = Aabr {
min: water_chunk * neighbor_coef + 4.0 - lake_width_noise * 8.0, 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, 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) .mul(0.1)
.clamped(0.0, 1.0); .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 stalk_radius = 2.5f32;
let head_radius = 12.0f32; 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) .mul(0.1)
.clamped(0.0, 1.0); .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 stalk_radius = 2.5f32;
let head_radius = 18.0f32; let head_radius = 18.0f32;