[Games] Add Quake 1 support.

This commit is contained in:
CosminPerRam 2023-05-30 16:18:04 +03:00
parent c874b463e3
commit af5e0d1fbf
5 changed files with 15 additions and 1 deletions

View file

@ -9,6 +9,7 @@ Protocols:
Games:
- [Quake 2](https://store.steampowered.com/app/2320/Quake_II/) support.
- [Quake 1](https://store.steampowered.com/app/2310/Quake/) support.
### Breaking:
- Every function that used `&str` for the address has been changed to `&IpAddr` (thanks [@Douile](https://github.com/Douile) for the re-re-write).

View file

@ -51,6 +51,7 @@ Beware of the `Notes` column, as it contains information about query port offset
| Frontlines: Fuel of War | FFOW | Valve Protocol (Proprietary) | Query Port offset: 2. |
| Crysis Wars | CW | GameSpy 3 | |
| Quake 2 | QUAKE2 | Quake 2 | |
| Quake 1 | QUAKE1 | Quake 1 | |
## Planned to add support:
_

View file

@ -2,7 +2,7 @@ use gamedig::protocols::{gamespy, quake};
use gamedig::protocols::minecraft::LegacyGroup;
use gamedig::protocols::valve;
use gamedig::protocols::valve::Engine;
use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw, quake2};
use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw, quake2, quake1};
use std::env;
use std::net::IpAddr;
@ -127,6 +127,7 @@ fn main() -> GDResult<()> {
"_quake2" => println!("{:#?}", quake::two::query(ip, port.unwrap(), None)),
"_quake3" => println!("{:#?}", quake::three::query(ip, port.unwrap(), None)),
"quake2" => println!("{:#?}", quake2::query(ip, port)?),
"quake1" => println!("{:#?}", quake1::query(ip, port)?),
_ => panic!("Undefined game: {}", args[1]),
};

View file

@ -96,3 +96,5 @@ pub mod vr;
pub mod cw;
/// Quake 2
pub mod quake2;
/// Quake 1
pub mod quake1;

9
src/games/quake1.rs Normal file
View file

@ -0,0 +1,9 @@
use std::net::IpAddr;
use crate::GDResult;
use crate::protocols::quake;
use crate::protocols::quake::Response;
use crate::protocols::quake::one::Player;
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<Response<Player>> {
quake::one::query(address, port.unwrap_or(27500), None)
}