diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/content/world/mines.rs | 2 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/proc_gen/mod.rs | 7 | ||||
| -rw-r--r-- | src/renderer/mod.rs | 4 | ||||
| -rw-r--r-- | src/sim/lib/components.rs | 2 | ||||
| -rw-r--r-- | src/sim/sim_manager/mod.rs | 5 | ||||
| -rw-r--r-- | src/sim/sim_manager/utils.rs | 8 | ||||
| -rw-r--r-- | src/vfx/mod.rs | 2 |
8 files changed, 13 insertions, 19 deletions
diff --git a/src/content/world/mines.rs b/src/content/world/mines.rs index 9e24a37..d750619 100644 --- a/src/content/world/mines.rs +++ b/src/content/world/mines.rs @@ -3,7 +3,7 @@ use glam::IVec2; use crate::{ content::materials::MaterialId, - proc_gen::{Biome, InterpolatedPixel, tileset_loader::TilePixelType}, + proc_gen::{Biome, InterpolatedPixel}, sim::cell::Cell, }; diff --git a/src/main.rs b/src/main.rs index 1c7abb1..019c8fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -200,7 +200,7 @@ impl ApplicationHandler for App { } if let Some(camera) = &self.camera { - self.input_manager.apply_event(&event, &camera); + self.input_manager.apply_event(&event, camera); } match event { diff --git a/src/proc_gen/mod.rs b/src/proc_gen/mod.rs index abdd0b8..f97df66 100644 --- a/src/proc_gen/mod.rs +++ b/src/proc_gen/mod.rs @@ -1,13 +1,8 @@ pub mod herringbone; pub mod tileset_loader; -use std::{ - cmp::Ordering, - collections::HashMap, - ops::{Add, Mul, Sub}, -}; +use std::ops::{Add, Mul, Sub}; -use fxhash::FxHashMap; use glam::IVec2; use crate::{ diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index aca2b17..b806b13 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -392,7 +392,7 @@ impl RendererState { let entity_capacity = 2048; let instance_buffer = create_instance_buffer(&device, CHUNK_SLOTS + entity_capacity); - let cell_buffer = create_cell_buffer(&device, (entity_capacity + CHUNK_SLOTS)); + let cell_buffer = create_cell_buffer(&device, entity_capacity + CHUNK_SLOTS ); let instance_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { label: None, @@ -985,7 +985,7 @@ impl RendererState { self.instance_buffer = create_instance_buffer(&self.device, self.entity_capacity + CHUNK_SLOTS); self.cell_buffer = - create_cell_buffer(&self.device, (CHUNK_SLOTS + self.entity_capacity) as usize); + create_cell_buffer(&self.device, ((CHUNK_SLOTS + self.entity_capacity))); } self.queue diff --git a/src/sim/lib/components.rs b/src/sim/lib/components.rs index f1c34ac..d43a567 100644 --- a/src/sim/lib/components.rs +++ b/src/sim/lib/components.rs @@ -111,7 +111,7 @@ pub fn compute_components(cells: &[Cell], w: i32, h: i32) -> Vec<PositionedCompo as usize] = old_cell.cell; } - let pc_centre = ((c.bounds[0] + c.bounds[1] + IVec2::ONE).as_vec2() / 2.0); + let pc_centre = (c.bounds[0] + c.bounds[1] + IVec2::ONE).as_vec2() / 2.0 ; let adjusted_pc_centre = pc_centre - (Vec2::new(w as f32, h as f32) / 2.0); let pc = PositionedComponent { position: adjusted_pc_centre, diff --git a/src/sim/sim_manager/mod.rs b/src/sim/sim_manager/mod.rs index ca68831..bbfd05e 100644 --- a/src/sim/sim_manager/mod.rs +++ b/src/sim/sim_manager/mod.rs @@ -174,13 +174,12 @@ impl SimManager { } } - if input_manager.pressed(Input::Action2) { - if let Some(entity_id) = written_entities_scope + if input_manager.pressed(Input::Action2) + && let Some(entity_id) = written_entities_scope .get_entity_id_at_position(input_manager.world_mouse_pos.round().as_ivec2()) { self.atomize_entity(entity_id); } - } // TEST ATOMIZATION diff --git a/src/sim/sim_manager/utils.rs b/src/sim/sim_manager/utils.rs index 45960bf..5bb7573 100644 --- a/src/sim/sim_manager/utils.rs +++ b/src/sim/sim_manager/utils.rs @@ -159,7 +159,7 @@ pub fn read_back_entities_from_world( let ec = entity.data.cells.as_mut().unwrap(); // first check if the entity has been partitioned let components = compute_components(&ec.cells, ec.size.x, ec.size.y); - if components.len() == 0 { + if components.is_empty() { sim.destroy_entity(entity_id); } else if components.len() == 1 { // the entity's cells were changed, but not partitioned @@ -193,9 +193,9 @@ pub fn read_back_entities_from_world( .get(entity.data.rb_h.unwrap()) // correctness -- not correct! because we don't have pos without rb .unwrap(); - let old_pose = old_rb.position().clone(); - let old_linvel = old_rb.linvel().clone(); - let old_angvel = old_rb.angvel().clone(); + let old_pose = *old_rb.position(); + let old_linvel = old_rb.linvel(); + let old_angvel = old_rb.angvel(); sim.destroy_entity(entity_id); diff --git a/src/vfx/mod.rs b/src/vfx/mod.rs index 3a7d1a5..eba436b 100644 --- a/src/vfx/mod.rs +++ b/src/vfx/mod.rs @@ -52,7 +52,7 @@ impl VfxManager { } impl VfxWriter for VfxManager { - fn write_vfx_line(&mut self, line: VfxLine) -> () { + fn write_vfx_line(&mut self, line: VfxLine) { self.lines.push(line); } } |
