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/game.rs | |
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/game.rs')
-rw-r--r-- | pixel-client/src/game.rs | 38 |
1 files changed, 15 insertions, 23 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) } } } |