mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-18 09:35:50 +00:00
[Protocol] Fixed quake 2 bug that version wouldn't always be present
This commit is contained in:
parent
a81a6ef968
commit
ada60f2376
3 changed files with 6 additions and 5 deletions
|
|
@ -119,8 +119,7 @@ pub(crate) fn client_query<Client: QuakeClient>(
|
|||
players,
|
||||
version: server_vars
|
||||
.remove("version")
|
||||
.or(server_vars.remove("*version"))
|
||||
.ok_or(GDError::PacketBad)?,
|
||||
.or(server_vars.remove("*version")),
|
||||
unused_entries: server_vars,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: String,
|
||||
pub 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 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 game_version(&self) -> Option<&str> { Some(&self.version) }
|
||||
|
||||
fn players(&self) -> Option<Vec<&dyn CommonPlayer>> {
|
||||
Some(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue