This commit is contained in:
gulag 2024-04-15 19:28:11 -04:00
parent da466f961b
commit f2aec40756
No known key found for this signature in database
GPG key ID: E67890ADC4227273
4 changed files with 13 additions and 12 deletions

View file

@ -26,7 +26,8 @@ impl ExcelCollection {
}
}
pub fn table_count(&self) -> usize {
#[must_use]
pub const fn table_count(&self) -> usize {
1
}
}

View file

@ -1,9 +1,7 @@
#[must_use]
pub fn load_or_create_config(path: &str, defaults: &str) -> String {
std::fs::read_to_string(path).map_or_else(
|_| {
std::fs::write(path, defaults).unwrap();
defaults.to_string()
},
|data| data,
)
std::fs::read_to_string(path).unwrap_or_else(|_| {
std::fs::write(path, defaults).unwrap();
defaults.to_string()
})
}

View file

@ -13,8 +13,8 @@ pub async fn query_dispatch() -> String {
retcode: 0,
region_list: CONFIGURATION
.game_servers
.iter()
.map(|(_, c)| RegionInfo {
.values()
.map(|c| RegionInfo {
name: c.name.clone(),
title: c.title.clone(),
env_type: c.env_type.clone(),
@ -46,7 +46,7 @@ pub async fn query_gateway(
Gateserver {
retcode: 0,
ip: server_config.gateserver_ip.clone(),
port: server_config.gateserver_port as u32,
port: u32::from(server_config.gateserver_port),
asset_bundle_url: version_config.asset_bundle_url.clone(),
ex_resource_url: version_config.ex_resource_url.clone(),
lua_url: version_config.lua_url.clone(),

View file

@ -1,6 +1,8 @@
use std::path::Path;
pub fn main() {
let proto_file = "StarRail.proto";
if std::path::Path::new(proto_file).exists() {
if Path::new(proto_file).exists() {
println!("cargo:rerun-if-changed={proto_file}");
prost_build::Config::new()