From 1bcb81be0b521476843e22a1c4cbec1c75dc2ec4 Mon Sep 17 00:00:00 2001 From: CoCo_Sol007 Date: Thu, 21 Mar 2024 22:01:10 +0100 Subject: [PATCH] remove fonction --- crates/border-wars/src/networking/connection.rs | 2 +- crates/border-wars/src/networking/mod.rs | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/crates/border-wars/src/networking/connection.rs b/crates/border-wars/src/networking/connection.rs index a73df1c..11180f6 100644 --- a/crates/border-wars/src/networking/connection.rs +++ b/crates/border-wars/src/networking/connection.rs @@ -43,7 +43,7 @@ pub fn accept_connection( // Check if the player is an admin if all_players .get_by_connection(&connection) - .map(|player| player.is_admin()) + .map(|player| player.rank == GameRank::Admin) != Some(true) { return; diff --git a/crates/border-wars/src/networking/mod.rs b/crates/border-wars/src/networking/mod.rs index bfc607f..2983659 100644 --- a/crates/border-wars/src/networking/mod.rs +++ b/crates/border-wars/src/networking/mod.rs @@ -37,14 +37,6 @@ impl AllPlayers { /// Get the player by a connection. pub fn get_by_connection(&self, connection: &Connection) -> Option<&Player> { let uuid = connection.identifier()?; - self.0.get(&uuid) } } - -impl Player { - /// Create a new player. - pub fn is_admin(&self) -> bool { - self.rank == GameRank::Admin - } -}