[Protocol] GS 1 rename Player's frags field to score to be more inline with the other protocols

This commit is contained in:
CosminPerRam 2023-07-20 19:27:06 +03:00
parent bec0f518b4
commit a81a6ef968
3 changed files with 6 additions and 7 deletions

View file

@ -6,7 +6,8 @@ Who knows what the future holds...
To be made...
### Breaking...
Nothing, yet...
Protocols:
- Gamespy 1: Renamed the players `frags` field to `score` to be more inline with the other protocols.
# 0.3.0 - 18/07/2023
### Changes:

View file

@ -147,7 +147,7 @@ fn extract_players(server_vars: &mut HashMap<String, String>, players_maximum: u
face: player_data.get("face").ok_or(GDError::PacketBad)?.clone(),
skin: player_data.get("skin").ok_or(GDError::PacketBad)?.clone(),
mesh: player_data.get("mesh").ok_or(GDError::PacketBad)?.clone(),
frags: player_data
score: player_data
.get("frags")
.ok_or(GDError::PacketBad)?
.trim()

View file

@ -18,19 +18,17 @@ pub struct Player {
pub face: String,
pub skin: String,
pub mesh: String,
pub frags: u32,
pub score: u32,
pub deaths: Option<u32>,
pub health: Option<u32>,
pub secret: bool,
}
impl CommonPlayer for Player {
fn as_original(&self) -> crate::protocols::types::GenericPlayer {
GenericPlayer::Gamespy(VersionedPlayer::One(self))
}
fn as_original(&self) -> GenericPlayer { GenericPlayer::Gamespy(VersionedPlayer::One(self)) }
fn name(&self) -> &str { &self.name }
// TODO: Maybe frags is score?
fn score(&self) -> Option<u32> { Some(self.score) }
}
/// A query response.