1
0
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:
MaxSignal
2025-11-13 16:08:58 +00:00
parent 2583429af8
commit 4bdb0ad1d0
3 changed files with 5 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ async-trait.workspace = true
futures.workspace = true
rand.workspace = true
num-quaternion.workspace = true
indexmap = { version = "2.0", features = ["serde"] }
# auth
libfj.workspace = true

View File

@@ -1,4 +1,5 @@
use std::collections::HashMap;
use indexmap::IndexMap;
use serde::{Serialize, Deserialize};
@@ -13,7 +14,7 @@ const CUBE_CONFIG_FILENAME: &str = "config.json";
#[derive(Serialize, Deserialize, Debug)]
pub struct CubeConfig {
cubes: HashMap<String, Cube>,
cubes: IndexMap<String, Cube>,
movement: HashMap<ItemCategory, MovementCategoryData>,
lerp_value: f32,
battle: BattleConfig,
@@ -326,7 +327,7 @@ impl <C: Clone + Send> super::ConfigProvider<C> for CubeConfig {
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
}

View File

@@ -22,7 +22,7 @@ pub trait ConfigProvider<C: Clone> {
fn server_config(&self) -> ServerConfig;
fn garage_upgrades(&self) -> GarageUpgrades;
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 gamemode_events(&self) -> GameEventSequence;
fn gamemodes(&self) -> crate::data::game_mode::GameModeConfigs; // FIXME