mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
Valve: Rename players-related fields
This commit is contained in:
parent
637252ca18
commit
ff789fcb90
5 changed files with 23 additions and 21 deletions
|
|
@ -15,6 +15,8 @@ Crate:
|
||||||
### Breaking:
|
### Breaking:
|
||||||
Protocols:
|
Protocols:
|
||||||
- Valve: The rules field is now a `HashMap<String, String>` instead of a `Vec<ServerRule>` (where the `ServerRule` structure had a name and a value fields).
|
- Valve: The rules field is now a `HashMap<String, String>` instead of a `Vec<ServerRule>` (where the `ServerRule` structure had a name and a value fields).
|
||||||
|
- Valve: `ServerInfo`'s `players`, `max_players` and `bots` have been renamed to `players_online`, `players_maximum` and `players_bots` respectively.
|
||||||
|
- Valve: `Response`'s `players`, `max_players` and `bots` have been renamed to `players_online`, `players_maximum` and `players_bots` respectively.
|
||||||
|
|
||||||
Errors:
|
Errors:
|
||||||
- Besides the `BadGame` error, now no other errors returns details about what happened (as it was quite pointless).
|
- Besides the `BadGame` error, now no other errors returns details about what happened (as it was quite pointless).
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ Response (note that some games have a different structure):
|
||||||
name: "Team Fortress 2 Dedicated Server.",
|
name: "Team Fortress 2 Dedicated Server.",
|
||||||
map: "ctf_turbine",
|
map: "ctf_turbine",
|
||||||
game: "tf2",
|
game: "tf2",
|
||||||
players: 0,
|
players_online: 0,
|
||||||
players_details: [],
|
players_details: [],
|
||||||
max_players: 69,
|
players_maximum: 69,
|
||||||
bots: 0,
|
players_bots: 0,
|
||||||
server_type: Dedicated,
|
server_type: Dedicated,
|
||||||
has_password: false,
|
has_password: false,
|
||||||
vac_secured: true,
|
vac_secured: true,
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,10 @@ impl Response {
|
||||||
name: response.info.name,
|
name: response.info.name,
|
||||||
map: response.info.map,
|
map: response.info.map,
|
||||||
game: response.info.game,
|
game: response.info.game,
|
||||||
players: response.info.players,
|
players: response.info.players_online,
|
||||||
players_details: response.players.unwrap().iter().map(TheShipPlayer::new_from_valve_player).collect(),
|
players_details: response.players.unwrap().iter().map(TheShipPlayer::new_from_valve_player).collect(),
|
||||||
max_players: response.info.max_players,
|
max_players: response.info.players_maximum,
|
||||||
bots: response.info.bots,
|
bots: response.info.players_bots,
|
||||||
server_type: response.info.server_type,
|
server_type: response.info.server_type,
|
||||||
has_password: response.info.has_password,
|
has_password: response.info.has_password,
|
||||||
vac_secured: response.info.vac_secured,
|
vac_secured: response.info.vac_secured,
|
||||||
|
|
|
||||||
|
|
@ -244,9 +244,9 @@ impl ValveProtocol {
|
||||||
folder,
|
folder,
|
||||||
game,
|
game,
|
||||||
appid: 0, //not present in the obsolete response
|
appid: 0, //not present in the obsolete response
|
||||||
players,
|
players_online: players,
|
||||||
max_players,
|
players_maximum: max_players,
|
||||||
bots,
|
players_bots: bots,
|
||||||
server_type,
|
server_type,
|
||||||
environment_type,
|
environment_type,
|
||||||
has_password,
|
has_password,
|
||||||
|
|
@ -343,9 +343,9 @@ impl ValveProtocol {
|
||||||
folder,
|
folder,
|
||||||
game,
|
game,
|
||||||
appid,
|
appid,
|
||||||
players,
|
players_online: players,
|
||||||
max_players,
|
players_maximum: max_players,
|
||||||
bots,
|
players_bots: bots,
|
||||||
server_type,
|
server_type,
|
||||||
environment_type,
|
environment_type,
|
||||||
has_password,
|
has_password,
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,11 @@ pub struct ServerInfo {
|
||||||
/// [Steam Application ID](https://developer.valvesoftware.com/wiki/Steam_Application_ID) of game.
|
/// [Steam Application ID](https://developer.valvesoftware.com/wiki/Steam_Application_ID) of game.
|
||||||
pub appid: u32,
|
pub appid: u32,
|
||||||
/// Number of players on the server.
|
/// Number of players on the server.
|
||||||
pub players: u8,
|
pub players_online: u8,
|
||||||
/// Maximum number of players the server reports it can hold.
|
/// Maximum number of players the server reports it can hold.
|
||||||
pub max_players: u8,
|
pub players_maximum: u8,
|
||||||
/// Number of bots on the server.
|
/// Number of bots on the server.
|
||||||
pub bots: u8,
|
pub players_bots: u8,
|
||||||
/// Dedicated, NonDedicated or SourceTV
|
/// Dedicated, NonDedicated or SourceTV
|
||||||
pub server_type: Server,
|
pub server_type: Server,
|
||||||
/// The Operating System that the server is on.
|
/// The Operating System that the server is on.
|
||||||
|
|
@ -265,10 +265,10 @@ pub mod game {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub map: String,
|
pub map: String,
|
||||||
pub game: String,
|
pub game: String,
|
||||||
pub players: u8,
|
pub players_online: u8,
|
||||||
pub players_details: Vec<Player>,
|
pub players_details: Vec<Player>,
|
||||||
pub max_players: u8,
|
pub players_maximum: u8,
|
||||||
pub bots: u8,
|
pub players_bots: u8,
|
||||||
pub server_type: Server,
|
pub server_type: Server,
|
||||||
pub has_password: bool,
|
pub has_password: bool,
|
||||||
pub vac_secured: bool,
|
pub vac_secured: bool,
|
||||||
|
|
@ -290,10 +290,10 @@ pub mod game {
|
||||||
name: response.info.name,
|
name: response.info.name,
|
||||||
map: response.info.map,
|
map: response.info.map,
|
||||||
game: response.info.game,
|
game: response.info.game,
|
||||||
players: response.info.players,
|
players_online: response.info.players_online,
|
||||||
players_details: response.players.unwrap_or(vec![]).iter().map(Player::from_valve_response).collect(),
|
players_details: response.players.unwrap_or(vec![]).iter().map(Player::from_valve_response).collect(),
|
||||||
max_players: response.info.max_players,
|
players_maximum: response.info.players_maximum,
|
||||||
bots: response.info.bots,
|
players_bots: response.info.players_bots,
|
||||||
server_type: response.info.server_type,
|
server_type: response.info.server_type,
|
||||||
has_password: response.info.has_password,
|
has_password: response.info.has_password,
|
||||||
vac_secured: response.info.vac_secured,
|
vac_secured: response.info.vac_secured,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue