From 229220494dd00bca38aed34ab6014968a35f91a1 Mon Sep 17 00:00:00 2001 From: Songtronix <505534-Songtronix@users.noreply.gitlab.com> Date: Mon, 1 Jul 2019 18:40:41 +0000 Subject: [PATCH] Fix warnings from world --- world/src/block/mod.rs | 28 ++++++++++++++-------------- world/src/column/mod.rs | 13 ++----------- world/src/lib.rs | 6 +++--- world/src/sim/mod.rs | 18 ++++++------------ 4 files changed, 25 insertions(+), 40 deletions(-) diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index 02e12d5ff5..2ec165464c 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -3,14 +3,14 @@ mod tree; use crate::{ column::{ColumnGen, ColumnSample}, util::{HashCache, RandomField, Sampler, SamplerMut}, - World, CONFIG, + World, }; use common::{ terrain::{structure::StructureBlock, Block}, vol::{ReadVol, Vox}, }; use noise::NoiseFn; -use std::ops::{Add, Div, Mul, Neg, Sub}; +use std::ops::{Add, Div, Mul, Neg}; use vek::*; pub struct BlockGen<'a> { @@ -91,19 +91,19 @@ impl<'a> SamplerMut for BlockGen<'a> { alt, chaos, water_level, - river, + //river, surface_color, sub_surface_color, - tree_density, - forest_kind, + //tree_density, + //forest_kind, close_trees, cave_xy, cave_alt, rock, - cliffs, + //cliffs, cliff_hill, close_cliffs, - temp, + //temp, .. } = Self::sample_column(column_gen, column_cache, Vec2::from(wpos))?; @@ -159,15 +159,15 @@ impl<'a> SamplerMut for BlockGen<'a> { // Sample blocks let stone_col = Rgb::new(200, 220, 255); - let dirt_col = Rgb::new(79, 67, 60); + // let dirt_col = Rgb::new(79, 67, 60); let air = Block::empty(); - let stone = Block::new(2, stone_col); - let surface_stone = Block::new(1, Rgb::new(200, 220, 255)); - let dirt = Block::new(1, dirt_col); - let sand = Block::new(1, Rgb::new(180, 150, 50)); + // let stone = Block::new(2, stone_col); + // let surface_stone = Block::new(1, Rgb::new(200, 220, 255)); + // let dirt = Block::new(1, dirt_col); + // let sand = Block::new(1, Rgb::new(180, 150, 50)); + // let warm_stone = Block::new(1, Rgb::new(165, 165, 130)); let water = Block::new(1, Rgb::new(100, 150, 255)); - let warm_stone = Block::new(1, Rgb::new(165, 165, 130)); let grass_depth = 2.0; let block = if (wposf.z as f32) < height - grass_depth { @@ -244,7 +244,7 @@ impl<'a> SamplerMut for BlockGen<'a> { pos: Vec3, structure_pos: Vec2, structure_seed: u32, - sample: &ColumnSample, + _sample: &ColumnSample, ) -> Block { let field = RandomField::new(structure_seed + 0); diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 05a27e6534..dff31775a0 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -1,18 +1,9 @@ -use crate::{ - all::ForestKind, - sim::{Location, LocationInfo}, - util::Sampler, - World, CONFIG, -}; -use common::{ - terrain::{Block, TerrainChunkSize}, - vol::{VolSize, Vox}, -}; +use crate::{all::ForestKind, sim::LocationInfo, util::Sampler, World, CONFIG}; +use common::{terrain::TerrainChunkSize, vol::VolSize}; use noise::NoiseFn; use std::{ f32, ops::{Add, Div, Mul, Neg, Sub}, - sync::Arc, }; use vek::*; diff --git a/world/src/lib.rs b/world/src/lib.rs index f4aee74a63..f54460d297 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -13,7 +13,7 @@ pub use crate::config::CONFIG; use crate::{ block::BlockGen, column::{ColumnGen, ColumnSample}, - util::{HashCache, Sampler, SamplerMut}, + util::{Sampler, SamplerMut}, }; use common::{ terrain::{Block, TerrainChunk, TerrainChunkMeta, TerrainChunkSize}, @@ -42,7 +42,7 @@ impl World { &self.sim } - pub fn tick(&self, dt: Duration) { + pub fn tick(&self, _dt: Duration) { // TODO } @@ -84,7 +84,7 @@ impl World { for y in 0..TerrainChunkSize::SIZE.y as i32 { let wpos2d = Vec2::new(x, y) + Vec3::from(chunk_pos) * TerrainChunkSize::SIZE.map(|e| e as i32); - let wposf2d = wpos2d.map(|e| e as f64); + let _wposf2d = wpos2d.map(|e| e as f64); let min_z = self .sim diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index 158a2d6aa8..fac42e2ff5 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -14,15 +14,9 @@ use common::{ terrain::{BiomeKind, TerrainChunkSize}, vol::VolSize, }; -use noise::{ - BasicMulti, HybridMulti, MultiFractal, NoiseFn, OpenSimplex, RidgedMulti, Seedable, - SuperSimplex, -}; +use noise::{BasicMulti, HybridMulti, MultiFractal, NoiseFn, RidgedMulti, Seedable, SuperSimplex}; use rand::{prng::XorShiftRng, Rng, SeedableRng}; -use std::{ - ops::{Add, Div, Mul, Neg, Sub}, - sync::Arc, -}; +use std::ops::{Add, Div, Mul, Sub}; use vek::*; pub const WORLD_SIZE: Vec2 = Vec2 { x: 1024, y: 1024 }; @@ -193,7 +187,7 @@ impl WorldSim { chunk_pos.x * TerrainChunkSize::SIZE.x as i32, chunk_pos.y * TerrainChunkSize::SIZE.y as i32, ); - let cell_pos = Vec2::new(i / cell_size, j / cell_size); + let _cell_pos = Vec2::new(i / cell_size, j / cell_size); // Find the distance to each region let near = gen.get(chunk_pos); @@ -359,7 +353,7 @@ impl SimChunk { .add(0.3) .max(0.0); - let dryness = (gen_ctx.dry_nz.get( + let dryness = gen_ctx.dry_nz.get( (wposf .add(Vec2::new( gen_ctx @@ -370,7 +364,7 @@ impl SimChunk { )) .div(2_000.0)) .into_array(), - ) as f32); + ) as f32; let chaos = (gen_ctx.chaos_nz.get((wposf.div(4_000.0)).into_array()) as f32) .add(1.0) @@ -409,7 +403,7 @@ impl SimChunk { .mul(chaos) .mul(CONFIG.mountain_scale); - let temp = (gen_ctx.temp_nz.get((wposf.div(8192.0)).into_array()) as f32); + let temp = gen_ctx.temp_nz.get((wposf.div(8192.0)).into_array()) as f32; let cliff = gen_ctx.cliff_nz.get((wposf.div(2048.0)).into_array()) as f32 + chaos * 0.2;