mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Use IndexMap instead of HashMap in CubeConfig
This commit is contained in:
@@ -21,6 +21,7 @@ async-trait.workspace = true
|
|||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
num-quaternion.workspace = true
|
num-quaternion.workspace = true
|
||||||
|
indexmap = { version = "2.0", features = ["serde"] }
|
||||||
|
|
||||||
# auth
|
# auth
|
||||||
libfj.workspace = true
|
libfj.workspace = true
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use indexmap::IndexMap;
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ const CUBE_CONFIG_FILENAME: &str = "config.json";
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct CubeConfig {
|
pub struct CubeConfig {
|
||||||
cubes: HashMap<String, Cube>,
|
cubes: IndexMap<String, Cube>,
|
||||||
movement: HashMap<ItemCategory, MovementCategoryData>,
|
movement: HashMap<ItemCategory, MovementCategoryData>,
|
||||||
lerp_value: f32,
|
lerp_value: f32,
|
||||||
battle: BattleConfig,
|
battle: BattleConfig,
|
||||||
@@ -326,7 +327,7 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
|
|||||||
crate::factory::Factory::from_config(&self.factory).await
|
crate::factory::Factory::from_config(&self.factory).await
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cubes(&self) -> &'_ std::collections::HashMap<String, crate::persist::Cube> {
|
fn cubes(&self) -> &'_ indexmap::IndexMap<String, crate::persist::Cube> {
|
||||||
&self.cubes
|
&self.cubes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ pub trait ConfigProvider<C: Clone> {
|
|||||||
fn server_config(&self) -> ServerConfig;
|
fn server_config(&self) -> ServerConfig;
|
||||||
fn garage_upgrades(&self) -> GarageUpgrades;
|
fn garage_upgrades(&self) -> GarageUpgrades;
|
||||||
async fn factory(&self) -> Result<crate::factory::Factory, Box<dyn std::error::Error + 'static>>;
|
async fn factory(&self) -> Result<crate::factory::Factory, Box<dyn std::error::Error + 'static>>;
|
||||||
fn cubes(&self) -> &'_ std::collections::HashMap<String, crate::persist::Cube>;
|
fn cubes(&self) -> &'_ indexmap::IndexMap<String, crate::persist::Cube>;
|
||||||
fn chat_system_config(&self) -> ChatSystemConfig;
|
fn chat_system_config(&self) -> ChatSystemConfig;
|
||||||
fn gamemode_events(&self) -> GameEventSequence;
|
fn gamemode_events(&self) -> GameEventSequence;
|
||||||
fn gamemodes(&self) -> crate::data::game_mode::GameModeConfigs; // FIXME
|
fn gamemodes(&self) -> crate::data::game_mode::GameModeConfigs; // FIXME
|
||||||
|
|||||||
Reference in New Issue
Block a user