mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Protocol] Standardize fields (#84)
* [Protocol] Standardize The Ship fields * [Protocol] Standardize FFOW fields * [Protocol] Rename Valve's protocol field to protocol_version * [Protocol] Rename Minecraft's version_protocol field to protocol_version * [Protocol] Rename Valve's version field to game_version * [Protocol] Rename Minecraft java version_name to game_version * [Crate] Reformat RESPONSES.md * [Protocol] Renamed Minecraft Java players_sample to players * [Protocol] Rename Quake (1,2,3) version field to game_version * [Protocol] Rename quake (1 and 2) game_type field to game_mode * [Protocol] Rename Valve, FFOW, TS game field to game_mode * [Generics] Rename game field/function to game_mode * [Protocol] Change players_minimum, _maximum and _bots from those who werent u8 or u32 to u32 * [Protocol] Change instances of player score field type from u32 to i32 * [Crate] Nicer gramar in CHANGELOG * [Protocol] Apply clippy fixes
This commit is contained in:
parent
65c56dc196
commit
9d8fb1ba94
25 changed files with 249 additions and 200 deletions
|
|
@ -118,7 +118,7 @@ pub(crate) fn client_query<Client: QuakeClient>(
|
|||
.parse()
|
||||
.map_err(|e| TypeParse.context(e))?,
|
||||
players,
|
||||
version: server_vars
|
||||
game_version: server_vars
|
||||
.remove("version")
|
||||
.or(server_vars.remove("*version")),
|
||||
unused_entries: server_vars,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ impl CommonPlayer for Player {
|
|||
fn as_original(&self) -> GenericPlayer { GenericPlayer::QuakeOne(self) }
|
||||
|
||||
fn name(&self) -> &str { &self.name }
|
||||
fn score(&self) -> Option<u32> { Some(self.score.into()) }
|
||||
fn score(&self) -> Option<i32> { Some(self.score.into()) }
|
||||
}
|
||||
|
||||
pub(crate) struct QuakeOne;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ impl CommonPlayer for Player {
|
|||
|
||||
fn name(&self) -> &str { &self.name }
|
||||
|
||||
fn score(&self) -> Option<u32> { Some(self.score.try_into().unwrap_or(0)) }
|
||||
fn score(&self) -> Option<i32> { Some(self.score) }
|
||||
}
|
||||
|
||||
pub(crate) struct QuakeTwo;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub struct Response<P> {
|
|||
/// Maximum number of players the server reports it can hold.
|
||||
pub players_maximum: u8,
|
||||
/// The server version.
|
||||
pub version: Option<String>,
|
||||
pub game_version: Option<String>,
|
||||
/// Other server entries that weren't used.
|
||||
pub unused_entries: HashMap<String, String>,
|
||||
}
|
||||
|
|
@ -35,10 +35,10 @@ impl<P: QuakePlayerType> CommonResponse for Response<P> {
|
|||
fn as_original(&self) -> GenericResponse { GenericResponse::Quake(P::version(self)) }
|
||||
|
||||
fn name(&self) -> Option<&str> { Some(&self.name) }
|
||||
fn game_version(&self) -> Option<&str> { self.version.as_deref() }
|
||||
fn game_version(&self) -> Option<&str> { self.game_version.as_deref() }
|
||||
fn map(&self) -> Option<&str> { Some(&self.map) }
|
||||
fn players_maximum(&self) -> u64 { self.players_maximum.into() }
|
||||
fn players_online(&self) -> u64 { self.players_online.into() }
|
||||
fn players_maximum(&self) -> u32 { self.players_maximum.into() }
|
||||
fn players_online(&self) -> u32 { self.players_online.into() }
|
||||
|
||||
fn players(&self) -> Option<Vec<&dyn CommonPlayer>> {
|
||||
Some(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue