mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Protocol] Add GameSpy 3 support. (#25)
* [Protocol] Gamespy3 initial code * [Protocol] Add rest of challenge solving * [Protocol] Remove unused stuff * [Protocol] Remove adding unused bytes * [Protocol] Clean up code * [Protocol] Make gs3 a struct * [Protocol] Add initial key-value parsing * [Protocol] Manage multiple packets * [Protocol] Split server vars and other vars * Revert "[Protocol] Split server vars and other vars" This reverts commit 9a930aeb68802fcf3d0908a2e031dfea054d37d0. * [Protocol] Proper packet management and initial response struct * [Protocol] Fix players_minimum * [Protocol] Fix server vars to parse only the first packet * [Protocol] Update CHANGELOG.md * [Protocol] Initial player parsing * [Protocol] Split GS one and three * [Protocol] Add common code file * [Protocol] Change static to const * [Protocol] Fix players_online and break on data to map on empty key * [Protocol] Remove unused types and printlns * [Protocol] Add teams parsing * [Protocol] Split key_values and parsing data * [Crate] Update PROTOCOLS.md
This commit is contained in:
parent
1b13d39856
commit
786da81ea5
14 changed files with 459 additions and 36 deletions
17
src/protocols/gamespy/common.rs
Normal file
17
src/protocols/gamespy/common.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use crate::{GDError, GDResult};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub fn has_password(server_vars: &mut HashMap<String, String>) -> GDResult<bool> {
|
||||
let password_value = server_vars
|
||||
.remove("password")
|
||||
.ok_or(GDError::PacketBad)?
|
||||
.to_lowercase();
|
||||
|
||||
if let Ok(has) = password_value.parse::<bool>() {
|
||||
return Ok(has);
|
||||
}
|
||||
|
||||
let as_numeral: u8 = password_value.parse().map_err(|_| GDError::TypeParse)?;
|
||||
|
||||
Ok(as_numeral != 0)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue