mirror of
https://git.mentality.rip/numas13/xash3d-master.git
synced 2025-01-22 04:44:31 +00:00
protocol: parse dedicated field in server info packet
This commit is contained in:
parent
a5dacb1b2e
commit
13a545be25
@ -450,6 +450,8 @@ pub struct GetServerInfoResponse<T> {
|
|||||||
pub coop: bool,
|
pub coop: bool,
|
||||||
/// Server is behind a password.
|
/// Server is behind a password.
|
||||||
pub password: bool,
|
pub password: bool,
|
||||||
|
/// Server is dedicated.
|
||||||
|
pub dedicated: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetServerInfoResponse<()> {
|
impl GetServerInfoResponse<()> {
|
||||||
@ -495,6 +497,7 @@ where
|
|||||||
b"gamedir" => ret.gamedir = cur.get_key_value()?,
|
b"gamedir" => ret.gamedir = cur.get_key_value()?,
|
||||||
b"password" => ret.password = cur.get_key_value()?,
|
b"password" => ret.password = cur.get_key_value()?,
|
||||||
b"host" => ret.host = cur.get_key_value()?,
|
b"host" => ret.host = cur.get_key_value()?,
|
||||||
|
b"dedicated" => ret.dedicated = cur.get_key_value()?,
|
||||||
_ => {
|
_ => {
|
||||||
// skip unknown fields
|
// skip unknown fields
|
||||||
let value = cur.get_key_value::<Str<&[u8]>>()?;
|
let value = cur.get_key_value::<Str<&[u8]>>()?;
|
||||||
@ -528,6 +531,7 @@ where
|
|||||||
.put_key("maxcl", self.maxcl)?
|
.put_key("maxcl", self.maxcl)?
|
||||||
.put_key("gamedir", &self.gamedir)?
|
.put_key("gamedir", &self.gamedir)?
|
||||||
.put_key("password", self.password)?
|
.put_key("password", self.password)?
|
||||||
|
.put_key("dedicated", self.dedicated)?
|
||||||
.put_key("host", &self.host)?
|
.put_key("host", &self.host)?
|
||||||
.pos())
|
.pos())
|
||||||
}
|
}
|
||||||
@ -630,6 +634,7 @@ mod tests {
|
|||||||
maxcl: 32,
|
maxcl: 32,
|
||||||
gamedir: Str("valve".as_bytes()),
|
gamedir: Str("valve".as_bytes()),
|
||||||
password: true,
|
password: true,
|
||||||
|
dedicated: true,
|
||||||
host: Str("Test".as_bytes()),
|
host: Str("Test".as_bytes()),
|
||||||
};
|
};
|
||||||
let mut buf = [0; 512];
|
let mut buf = [0; 512];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user