Skip to content

Commit

Permalink
cargo clippy --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyTornetta committed Oct 22, 2023
1 parent ee753d9 commit f615a10
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
9 changes: 3 additions & 6 deletions cosmos_server/src/structure/planet/biosphere/biome/desert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,15 @@ impl Biome for DesertBiome {
sx + 456.0 * rng_changer as f64,
sy + 4645.0 * rng_changer as f64,
sz + 354.0 * rng_changer as f64,
)
.abs() as CoordinateType
).unsigned_abs()
% CHUNK_DIMENSIONS;

let z = seed
.chaos_hash(
sx + 678.0 * rng_changer as f64,
sy + 87.0 * rng_changer as f64,
sz + 456.0 * rng_changer as f64,
)
.abs() as CoordinateType
).unsigned_abs()
% CHUNK_DIMENSIONS;

let coords: BlockCoordinate = match block_up {
Expand Down Expand Up @@ -140,8 +138,7 @@ impl Biome for DesertBiome {
sx + 561.0 * rng_changer as f64,
sy + 456.0 * rng_changer as f64,
sz + 786.0 * rng_changer as f64,
)
.abs() as CoordinateType
).unsigned_abs()
% MAX_CACTUS_HEIGHT
+ 1;

Expand Down
6 changes: 6 additions & 0 deletions cosmos_server/src/structure/planet/biosphere/biome/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ fn generate_corner_chunk<C: BlockStorer>(
/// This is mostly used to keep performance to a maximum.
pub struct BiomeIdList(Box<[u8; (CHUNK_DIMENSIONS * CHUNK_DIMENSIONS * CHUNK_DIMENSIONS) as usize]>);

impl Default for BiomeIdList {
fn default() -> Self {
Self::new()
}
}

impl BiomeIdList {
/// Initializes a Biome Id List to be all 0s.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ fn calculate_biomes<'a, T: BiosphereMarkerComponent>(

let block_coords = first_block_coord + BlockCoordinate::new(x * scale, y * scale, z * scale);

let biome_params = biome_decider.biome_parameters_at(structure_location, block_coords, &noise_generator);
let biome_params = biome_decider.biome_parameters_at(structure_location, block_coords, noise_generator);

let idx = biosphere_biomes.ideal_biome_index_for(biome_params);

Expand Down
6 changes: 3 additions & 3 deletions cosmos_server/src/structure/planet/biosphere/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ impl<T: BiosphereMarkerComponent> BiomeDecider<T> {
humidity = (humidity.min(0.999).max(-1.0) * 0.5 + 0.5) * 100.0;
elevation = (elevation.min(0.999).max(-1.0) * 0.5 + 0.5) * 100.0;

debug_assert!(elevation >= 0.0 && elevation < 100.0, "Bad elevation: {elevation}",);
debug_assert!(humidity >= 0.0 && humidity < 100.0, "Bad humidity: {humidity}",);
debug_assert!(temperature >= 0.0 && temperature < 100.0, "Bad temperature: {temperature}",);
debug_assert!((0.0..100.0).contains(&elevation), "Bad elevation: {elevation}",);
debug_assert!((0.0..100.0).contains(&humidity), "Bad humidity: {humidity}",);
debug_assert!((0.0..100.0).contains(&temperature), "Bad temperature: {temperature}",);

BiomeParameters {
ideal_elevation: elevation as f32,
Expand Down

0 comments on commit f615a10

Please sign in to comment.