diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a3397f..df05d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Crate: ### Breaking: Protocols: - Valve: The rules field is now a `HashMap` instead of a `Vec` (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: - Besides the `BadGame` error, now no other errors returns details about what happened (as it was quite pointless). diff --git a/README.md b/README.md index d10dfb9..e10c783 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,10 @@ Response (note that some games have a different structure): name: "Team Fortress 2 Dedicated Server.", map: "ctf_turbine", game: "tf2", - players: 0, + players_online: 0, players_details: [], - max_players: 69, - bots: 0, + players_maximum: 69, + players_bots: 0, server_type: Dedicated, has_password: false, vac_secured: true, diff --git a/src/games/ts.rs b/src/games/ts.rs index 9684a41..4809619 100644 --- a/src/games/ts.rs +++ b/src/games/ts.rs @@ -60,10 +60,10 @@ impl Response { name: response.info.name, map: response.info.map, 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(), - max_players: response.info.max_players, - bots: response.info.bots, + max_players: response.info.players_maximum, + bots: response.info.players_bots, server_type: response.info.server_type, has_password: response.info.has_password, vac_secured: response.info.vac_secured, diff --git a/src/protocols/valve/protocol.rs b/src/protocols/valve/protocol.rs index 80dbb25..80eddc8 100644 --- a/src/protocols/valve/protocol.rs +++ b/src/protocols/valve/protocol.rs @@ -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, diff --git a/src/protocols/valve/types.rs b/src/protocols/valve/types.rs index d0697a1..668c6fa 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -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, - 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,