mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
Initial the ship support
This commit is contained in:
parent
192d50a11d
commit
5cf5615265
3 changed files with 20 additions and 2 deletions
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
pub mod tf2;
|
||||
pub mod the_ship;
|
||||
|
||||
pub use tf2::*;
|
||||
pub use the_ship::*;
|
||||
|
|
|
|||
16
src/games/the_ship.rs
Normal file
16
src/games/the_ship.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use crate::errors::GDError;
|
||||
use crate::valve::{ValveProtocol, App, GatheringSettings, Response};
|
||||
|
||||
pub struct TheShip;
|
||||
|
||||
impl TheShip {
|
||||
pub fn query(address: &str, port: Option<u16>) -> Result<Response, GDError> {
|
||||
ValveProtocol::query(App::TheShip, address, match port {
|
||||
None => 27015,
|
||||
Some(port) => port
|
||||
}, GatheringSettings {
|
||||
players: false,
|
||||
rules: false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -102,8 +102,8 @@ impl TryFrom<u16> for App {
|
|||
fn try_from(value: u16) -> Result<Self, Self::Error> {
|
||||
match value {
|
||||
x if x == App::TF2 as u16 => Ok(App::TF2),
|
||||
x if x == App::TF2 as u16 => Ok(App::CSGO),
|
||||
x if x == App::TF2 as u16 => Ok(App::TheShip),
|
||||
x if x == App::CSGO as u16 => Ok(App::CSGO),
|
||||
x if x == App::TheShip as u16 => Ok(App::TheShip),
|
||||
_ => Err(GDError::UnknownEnumCast),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue