aboutsummaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-06-06 21:38:24 +0200
committermetamuffin <metamuffin@disroot.org>2025-06-06 21:38:24 +0200
commitf8dfbaa2869f40253ccd19ee3655b8dbd5390d8e (patch)
treed1ce15aa264a787c81ca996752e5c2736d21fb62 /server/src
parent205d5f2ae8eaea03a78d3c027913c0fa44acceea (diff)
downloadhurrycurry-f8dfbaa2869f40253ccd19ee3655b8dbd5390d8e.tar
hurrycurry-f8dfbaa2869f40253ccd19ee3655b8dbd5390d8e.tar.bz2
hurrycurry-f8dfbaa2869f40253ccd19ee3655b8dbd5390d8e.tar.zst
manual clippy and other cleanup
Diffstat (limited to 'server/src')
-rw-r--r--server/src/commands.rs2
-rw-r--r--server/src/entity/pedestrians.rs2
-rw-r--r--server/src/entity/player_portal.rs2
-rw-r--r--server/src/entity/tram.rs2
-rw-r--r--server/src/server.rs21
-rw-r--r--server/src/state.rs2
6 files changed, 15 insertions, 16 deletions
diff --git a/server/src/commands.rs b/server/src/commands.rs
index a0702a05..bf392708 100644
--- a/server/src/commands.rs
+++ b/server/src/commands.rs
@@ -258,7 +258,7 @@ impl Server {
if let Some(board) = self.scoreboard.get(mapname) {
if text {
- let mut o = format!("Scoreboard for {}:\n", mapname);
+ let mut o = format!("Scoreboard for {mapname}:\n");
for (i, entry) in board.best.iter().take(5).enumerate() {
writeln!(
o,
diff --git a/server/src/entity/pedestrians.rs b/server/src/entity/pedestrians.rs
index cedb9e46..2ddbb920 100644
--- a/server/src/entity/pedestrians.rs
+++ b/server/src/entity/pedestrians.rs
@@ -47,7 +47,7 @@ impl Entity for Pedestrians {
},
class: PlayerClass::Customer,
id: Some(id),
- position: self.points.get(0).copied(),
+ position: self.points.first().copied(),
});
self.players.insert(id, 0);
self.cooldown += self.spawn_delay_distr.sample(&mut rng()).max(0.1);
diff --git a/server/src/entity/player_portal.rs b/server/src/entity/player_portal.rs
index c0faf767..96168faa 100644
--- a/server/src/entity/player_portal.rs
+++ b/server/src/entity/player_portal.rs
@@ -15,7 +15,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-use super::{EntityContext, Entity};
+use super::{Entity, EntityContext};
use anyhow::{anyhow, Result};
use hurrycurry_protocol::{glam::Vec2, PacketC};
diff --git a/server/src/entity/tram.rs b/server/src/entity/tram.rs
index d1d1effa..06e151d7 100644
--- a/server/src/entity/tram.rs
+++ b/server/src/entity/tram.rs
@@ -43,7 +43,7 @@ impl Entity for Tram {
character: self.character,
class: PlayerClass::Tram,
id: Some(id),
- position: self.points.get(0).copied(),
+ position: self.points.first().copied(),
});
self.ids.push(id);
}
diff --git a/server/src/server.rs b/server/src/server.rs
index 95cf182c..368a79a9 100644
--- a/server/src/server.rs
+++ b/server/src/server.rs
@@ -69,6 +69,7 @@ pub trait GameServerExt {
timer: Option<Duration>,
packet_out: &mut VecDeque<PacketC>,
);
+ #[allow(clippy::too_many_arguments)]
fn join_player(
&mut self,
id: PlayerID,
@@ -417,17 +418,15 @@ impl Server {
self.game.players_spatial_index.remove_entry(player);
// TODO if holding two, one is destroyed
- for item in p.items {
- if let Some(item) = item {
- let pos = p.movement.position.floor().as_ivec2();
- if let Some(tile) = self.game.tiles.get_mut(&pos) {
- if tile.item.is_none() {
- self.packet_out.push_back(PacketC::SetItem {
- location: ItemLocation::Tile(pos),
- item: Some(item.kind),
- });
- tile.item = Some(item);
- }
+ for item in p.items.into_iter().flatten() {
+ let pos = p.movement.position.floor().as_ivec2();
+ if let Some(tile) = self.game.tiles.get_mut(&pos) {
+ if tile.item.is_none() {
+ self.packet_out.push_back(PacketC::SetItem {
+ location: ItemLocation::Tile(pos),
+ item: Some(item.kind),
+ });
+ tile.item = Some(item);
}
}
}
diff --git a/server/src/state.rs b/server/src/state.rs
index a509a3bd..bd97266e 100644
--- a/server/src/state.rs
+++ b/server/src/state.rs
@@ -24,7 +24,7 @@ impl Server {
pub async fn tick_outer(&mut self, dt: f32) -> anyhow::Result<()> {
let should_pause = self.connections.iter().all(|c| c.1 .1);
if should_pause != self.paused {
- info!("Game paused: {}", should_pause);
+ info!("Game paused: {should_pause}");
self.paused = should_pause;
for p in self.game.players.keys() {
self.packet_out