Valve: Rename players-related fields

This commit is contained in:
CosminPerRam 2023-01-13 19:36:03 +02:00
parent 637252ca18
commit ff789fcb90
5 changed files with 23 additions and 21 deletions

View file

@ -244,9 +244,9 @@ impl ValveProtocol {
folder,
game,
appid: 0, //not present in the obsolete response
players,
max_players,
bots,
players_online: players,
players_maximum: max_players,
players_bots: bots,
server_type,
environment_type,
has_password,
@ -343,9 +343,9 @@ impl ValveProtocol {
folder,
game,
appid,
players,
max_players,
bots,
players_online: players,
players_maximum: max_players,
players_bots: bots,
server_type,
environment_type,
has_password,

View file

@ -40,11 +40,11 @@ pub struct ServerInfo {
/// [Steam Application ID](https://developer.valvesoftware.com/wiki/Steam_Application_ID) of game.
pub appid: u32,
/// Number of players on the server.
pub players: u8,
pub players_online: u8,
/// Maximum number of players the server reports it can hold.
pub max_players: u8,
pub players_maximum: u8,
/// Number of bots on the server.
pub bots: u8,
pub players_bots: u8,
/// Dedicated, NonDedicated or SourceTV
pub server_type: Server,
/// The Operating System that the server is on.
@ -265,10 +265,10 @@ pub mod game {
pub name: String,
pub map: String,
pub game: String,
pub players: u8,
pub players_online: u8,
pub players_details: Vec<Player>,
pub max_players: u8,
pub bots: u8,
pub players_maximum: u8,
pub players_bots: u8,
pub server_type: Server,
pub has_password: bool,
pub vac_secured: bool,
@ -290,10 +290,10 @@ pub mod game {
name: response.info.name,
map: response.info.map,
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(),
max_players: response.info.max_players,
bots: response.info.bots,
players_maximum: response.info.players_maximum,
players_bots: response.info.players_bots,
server_type: response.info.server_type,
has_password: response.info.has_password,
vac_secured: response.info.vac_secured,