mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-18 09:35:50 +00:00
Valve Protocol: Players with no name (name length == 0), are no more added to players details
This commit is contained in:
parent
5c664187f9
commit
c5a35016d1
1 changed files with 23 additions and 13 deletions
|
|
@ -366,19 +366,29 @@ impl ValveProtocol {
|
|||
|
||||
for _ in 0..count {
|
||||
buffer.move_position_ahead(1); //skip the index byte
|
||||
players.push(ServerPlayer {
|
||||
name: buffer.get_string_utf8()?,
|
||||
score: buffer.get_u32()?,
|
||||
duration: buffer.get_f32()?,
|
||||
deaths: match *app == SteamID::TS.as_app() {
|
||||
false => None,
|
||||
true => Some(buffer.get_u32()?)
|
||||
},
|
||||
money: match *app == SteamID::TS.as_app() {
|
||||
false => None,
|
||||
true => Some(buffer.get_u32()?)
|
||||
}
|
||||
});
|
||||
|
||||
let name = buffer.get_string_utf8()?;
|
||||
let score = buffer.get_u32()?;
|
||||
let duration = buffer.get_f32()?;
|
||||
|
||||
let deaths = match *app == SteamID::TS.as_app() {
|
||||
false => None,
|
||||
true => Some(buffer.get_u32()?)
|
||||
};
|
||||
let money = match *app == SteamID::TS.as_app() {
|
||||
false => None,
|
||||
true => Some(buffer.get_u32()?)
|
||||
};
|
||||
|
||||
if name.len() > 0 {
|
||||
players.push(ServerPlayer {
|
||||
name,
|
||||
score,
|
||||
duration,
|
||||
deaths,
|
||||
money
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Ok(players)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue