rust-gamedig/src/protocols/quake/three.rs
Tom 3b9c784e70
Reduce game implementation repetition (#122)
* [Games] Add macro to replace valve game query implementations

This somewhat reduces repeated code (#120), and also adds auto-generated
doc comments to all valve game query functions.

* [Games] Add macro to replace gamespy game query implementations

This somewhat reduces repeated code (#120), and also adds auto-generated
doc comments to all gamespy game query functions.

* [Games] Add macro to replace quake game query implementations

This somewhat reduces repeated code (#120), and also adds auto-generated
doc comments to all quake game query functions.

* [Games] Move all valve game modules into a single file using macros

Vastly reduces the number of files. However does break the game
definition-per-file test, so that was removed.

* [Games] Move all quake game modules into a single file using macros

* [Games] Move all gamespy game modules into a single file using macros

* [Docs] Update CHANGELOG

* [Docs] Improve game query function generation macro documentation

* [Games] Add missed Halo: Combat Evolved to gamespy
2023-10-10 09:26:35 +03:00

24 lines
801 B
Rust

use crate::protocols::quake::client::{client_query, QuakeClient};
use crate::protocols::quake::two::QuakeTwo;
use crate::protocols::quake::Response;
use crate::protocols::types::TimeoutSettings;
use crate::GDResult;
use std::net::SocketAddr;
use std::slice::Iter;
pub use crate::protocols::quake::two::Player;
struct QuakeThree;
impl QuakeClient for QuakeThree {
type Player = Player;
fn get_send_header<'a>() -> &'a str { "getstatus" }
fn get_response_header<'a>() -> &'a str { "statusResponse\n" }
fn parse_player_string(data: Iter<&str>) -> GDResult<Self::Player> { QuakeTwo::parse_player_string(data) }
}
pub fn query(address: &SocketAddr, timeout_settings: Option<TimeoutSettings>) -> GDResult<Response<Player>> {
client_query::<QuakeThree>(address, timeout_settings)
}