Initial the ship support

This commit is contained in:
cosminperram 2022-10-19 22:47:52 +03:00
parent 192d50a11d
commit 5cf5615265
3 changed files with 20 additions and 2 deletions

View file

@ -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
View 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
})
}
}

View file

@ -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),
}
}