Master server for Half-Life/Xash3D.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
// SPDX-FileCopyrightText: 2023 Denis Drakhnia <numas13@gmail.com>
|
|
|
|
|
|
|
|
use super::filter::{FilterFlags, Version};
|
|
|
|
use super::server::{Region, ServerAdd};
|
|
|
|
use super::types::Str;
|
|
|
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
pub struct ServerInfo {
|
|
|
|
pub version: Version,
|
|
|
|
pub protocol: u8,
|
|
|
|
pub gamedir: Box<[u8]>,
|
|
|
|
pub map: Box<[u8]>,
|
|
|
|
pub flags: FilterFlags,
|
|
|
|
pub region: Region,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ServerInfo {
|
|
|
|
pub fn new(info: &ServerAdd<Str<&[u8]>>) -> Self {
|
|
|
|
Self {
|
|
|
|
version: info.version,
|
|
|
|
protocol: info.protocol,
|
|
|
|
gamedir: info.gamedir.to_vec().into_boxed_slice(),
|
|
|
|
map: info.map.to_vec().into_boxed_slice(),
|
|
|
|
flags: FilterFlags::from(info),
|
|
|
|
region: info.region,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|