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.

38 lines
1.0 KiB

// SPDX-License-Identifier: LGPL-3.0-only
// SPDX-FileCopyrightText: 2023 Denis Drakhnia <numas13@gmail.com>
use super::filter::{FilterFlags, Version};
use super::server::{Region, ServerAdd};
use super::wrappers::Str;
/// Game server information.
#[derive(Clone, Debug)]
pub struct ServerInfo {
/// Server version.
pub version: Version,
/// Server protocol version.
pub protocol: u8,
/// Server midification.
pub gamedir: Box<[u8]>,
/// Server map.
pub map: Box<[u8]>,
/// Server additional filter flags.
pub flags: FilterFlags,
/// Server region.
pub region: Region,
}
impl ServerInfo {
/// Creates a new `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,
}
}
}