mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Protocol] Renamed quake 2's player's frags field to score to be more inline with the other protocols
This commit is contained in:
parent
84ebeb8065
commit
f7e93fd7cd
2 changed files with 7 additions and 3 deletions
|
|
@ -16,6 +16,9 @@ Games:
|
||||||
- [Just Cause 2: Multiplayer](https://store.steampowered.com/app/259080/Just_Cause_2_Multiplayer_Mod/) support.
|
- [Just Cause 2: Multiplayer](https://store.steampowered.com/app/259080/Just_Cause_2_Multiplayer_Mod/) support.
|
||||||
|
|
||||||
### Breaking...
|
### Breaking...
|
||||||
|
Protocols:
|
||||||
|
- Quake 2: Renamed the players frags field to score to be more inline with the other protocols.
|
||||||
|
|
||||||
Crate:
|
Crate:
|
||||||
- Fixed crate's `rust-version`, it is now `1.60.0` (was `1.56.1`)
|
- Fixed crate's `rust-version`, it is now `1.60.0` (was `1.56.1`)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use super::QuakePlayerType;
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
pub struct Player {
|
pub struct Player {
|
||||||
pub frags: i16,
|
pub score: i32,
|
||||||
pub ping: u16,
|
pub ping: u16,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub address: Option<String>,
|
pub address: Option<String>,
|
||||||
|
|
@ -30,7 +30,8 @@ impl CommonPlayer for Player {
|
||||||
fn as_original(&self) -> GenericPlayer { GenericPlayer::QuakeTwo(self) }
|
fn as_original(&self) -> GenericPlayer { GenericPlayer::QuakeTwo(self) }
|
||||||
|
|
||||||
fn name(&self) -> &str { &self.name }
|
fn name(&self) -> &str { &self.name }
|
||||||
// TODO: Maybe frags is score?
|
|
||||||
|
fn score(&self) -> Option<u32> { Some(self.score.into()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct QuakeTwo;
|
pub(crate) struct QuakeTwo;
|
||||||
|
|
@ -43,7 +44,7 @@ impl QuakeClient for QuakeTwo {
|
||||||
|
|
||||||
fn parse_player_string(mut data: Iter<&str>) -> GDResult<Self::Player> {
|
fn parse_player_string(mut data: Iter<&str>) -> GDResult<Self::Player> {
|
||||||
Ok(Player {
|
Ok(Player {
|
||||||
frags: match data.next() {
|
score: match data.next() {
|
||||||
None => Err(GDError::PacketBad)?,
|
None => Err(GDError::PacketBad)?,
|
||||||
Some(v) => v.parse().map_err(|_| GDError::PacketBad)?,
|
Some(v) => v.parse().map_err(|_| GDError::PacketBad)?,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue