diff options
author | metamuffin <metamuffin@disroot.org> | 2025-06-06 21:38:24 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-06-06 21:38:24 +0200 |
commit | f8dfbaa2869f40253ccd19ee3655b8dbd5390d8e (patch) | |
tree | d1ce15aa264a787c81ca996752e5c2736d21fb62 /pixel-client/src | |
parent | 205d5f2ae8eaea03a78d3c027913c0fa44acceea (diff) | |
download | hurrycurry-f8dfbaa2869f40253ccd19ee3655b8dbd5390d8e.tar hurrycurry-f8dfbaa2869f40253ccd19ee3655b8dbd5390d8e.tar.bz2 hurrycurry-f8dfbaa2869f40253ccd19ee3655b8dbd5390d8e.tar.zst |
manual clippy and other cleanup
Diffstat (limited to 'pixel-client/src')
-rw-r--r-- | pixel-client/src/game.rs | 38 | ||||
-rw-r--r-- | pixel-client/src/menu/ingame.rs | 2 | ||||
-rw-r--r-- | pixel-client/src/menu/main.rs | 2 | ||||
-rw-r--r-- | pixel-client/src/menu/mod.rs | 4 | ||||
-rw-r--r-- | pixel-client/src/menu/settings.rs | 2 |
5 files changed, 20 insertions, 28 deletions
diff --git a/pixel-client/src/game.rs b/pixel-client/src/game.rs index 32760364..0c5661c2 100644 --- a/pixel-client/src/game.rs +++ b/pixel-client/src/game.rs @@ -212,11 +212,9 @@ impl Game { }); for player in self.players.values_mut() { - for item in &mut player.items { - if let Some(item) = item { - item.parent_position = player.movement.position; - item.tick(1., dt); - } + for item in player.items.iter_mut().flatten() { + item.parent_position = player.movement.position; + item.tick(1., dt); } } for tile in self.tiles.values_mut() { @@ -360,10 +358,8 @@ impl Game { }) } PacketC::ClearProgress { item } => { - if let Some(slot) = self.get_item(item) { - if let Some(item) = slot { - item.active = None; - } + if let Some(Some(item)) = self.get_item(item) { + item.active = None; } } PacketC::SetProgress { @@ -373,16 +369,14 @@ impl Game { player, warn, } => { - if let Some(slot) = self.get_item(item) { - if let Some(item) = slot { - item.active = Some(Involvement { - position, - speed, - player, - warn, - recipe: RecipeIndex(0), - }); - } + if let Some(Some(item)) = self.get_item(item) { + item.active = Some(Involvement { + position, + speed, + player, + warn, + recipe: RecipeIndex(0), + }); } } PacketC::ServerMessage { .. } => { @@ -517,10 +511,8 @@ impl Player { _ => (), } } - for item in &self.items { - if let Some(item) = item { - item.draw(ctx, item_sprites) - } + for item in self.items.iter().flatten() { + item.draw(ctx, item_sprites) } } } diff --git a/pixel-client/src/menu/ingame.rs b/pixel-client/src/menu/ingame.rs index 991faad6..66c77bce 100644 --- a/pixel-client/src/menu/ingame.rs +++ b/pixel-client/src/menu/ingame.rs @@ -2,8 +2,8 @@ use super::main::MainMenu; use crate::{ config::Config, game::Game, - strings::tr, render::{sprite::SpriteDraw, AtlasLayout, Renderer}, + strings::tr, ui::UiState, State, }; diff --git a/pixel-client/src/menu/main.rs b/pixel-client/src/menu/main.rs index 38dcaaea..7320ff3b 100644 --- a/pixel-client/src/menu/main.rs +++ b/pixel-client/src/menu/main.rs @@ -21,8 +21,8 @@ use super::{ use crate::{ config::Config, game::Game, - strings::tr, render::{sprite::SpriteDraw, AtlasLayout, Renderer}, + strings::tr, ui::UiState, State, }; diff --git a/pixel-client/src/menu/mod.rs b/pixel-client/src/menu/mod.rs index 167d38e0..4e41fc7b 100644 --- a/pixel-client/src/menu/mod.rs +++ b/pixel-client/src/menu/mod.rs @@ -15,8 +15,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -pub mod main; pub mod background; -pub mod settings; pub mod credits; pub mod ingame; +pub mod main; +pub mod settings; diff --git a/pixel-client/src/menu/settings.rs b/pixel-client/src/menu/settings.rs index 6f4a20fe..91d43025 100644 --- a/pixel-client/src/menu/settings.rs +++ b/pixel-client/src/menu/settings.rs @@ -15,7 +15,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -use crate::{config::Config, strings::tr, render::sprite::SpriteDraw, ui::Ui}; +use crate::{config::Config, render::sprite::SpriteDraw, strings::tr, ui::Ui}; use hurrycurry_protocol::glam::Vec2; use log::warn; |