Skip to content

Commit

Permalink
chore: Fix cargo clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
AudranTourneur committed Nov 14, 2024
1 parent 43576c1 commit 89b8d93
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
49 changes: 23 additions & 26 deletions client/src/network/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,34 @@ pub fn update_world_from_network(
let msg = bincode::options()
.deserialize::<ServerToClientMessage>(&bytes)
.unwrap();
match msg {
ServerToClientMessage::WorldUpdate(world_update) => {
println!(
"Received world update, {} chunks received",
world_update.new_map.len()
);
if let ServerToClientMessage::WorldUpdate(world_update) = msg {
println!(
"Received world update, {} chunks received",
world_update.new_map.len()
);

println!("Chunks positions : {:?}", world_update.new_map.keys());
println!("Chunks positions : {:?}", world_update.new_map.keys());

for (pos, chunk) in world_update.new_map {
// If the chunk is not in render distance range or is empty, do not consider it
if !chunk_in_radius(&player_pos, &pos, r) || chunk.map.is_empty() {
continue;
}
for (pos, chunk) in world_update.new_map {
// If the chunk is not in render distance range or is empty, do not consider it
if !chunk_in_radius(&player_pos, &pos, r) || chunk.map.is_empty() {
continue;
}

let chunk = crate::world::Chunk {
map: chunk.map,
entity: {
if let Some(c) = world.map.get(&pos) {
c.entity
} else {
None
}
},
};
let chunk = crate::world::Chunk {
map: chunk.map,
entity: {
if let Some(c) = world.map.get(&pos) {
c.entity
} else {
None
}
},
};

world.map.insert(pos, chunk);
ev_render.send(WorldRenderRequestUpdateEvent::ChunkToReload(pos));
}
world.map.insert(pos, chunk);
ev_render.send(WorldRenderRequestUpdateEvent::ChunkToReload(pos));
}
_ => {}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion client/src/world/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn update_chunk(
PbrBundle {
mesh: meshes.add(new_mesh),
material: texture.clone(),
transform: chunk_t.clone(),
transform: chunk_t,
..Default::default()
},
RaycastMesh::<BlockRaycastSet>::default(),
Expand All @@ -67,6 +67,7 @@ fn update_chunk(
// println!("Chunk updated : len={}", chunk.map.len());
}

#[allow(clippy::too_many_arguments)]
pub fn world_render_system(
mut world_map: ResMut<WorldMap>,
material_resource: Res<MaterialResource>,
Expand Down

0 comments on commit 89b8d93

Please sign in to comment.