From 4bdb0ad1d0d00ae959e6aa8919db2a3773a08b13 Mon Sep 17 00:00:00 2001 From: MaxSignal Date: Thu, 13 Nov 2025 16:08:58 +0000 Subject: [PATCH] Use IndexMap instead of HashMap in CubeConfig --- rc_core/Cargo.toml | 1 + rc_core/src/persist/config/cubes_json.rs | 5 +++-- rc_core/src/persist/config/traits.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/rc_core/Cargo.toml b/rc_core/Cargo.toml index dddc3f9..0c2f497 100644 --- a/rc_core/Cargo.toml +++ b/rc_core/Cargo.toml @@ -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 diff --git a/rc_core/src/persist/config/cubes_json.rs b/rc_core/src/persist/config/cubes_json.rs index 3b0d9fb..a24805c 100644 --- a/rc_core/src/persist/config/cubes_json.rs +++ b/rc_core/src/persist/config/cubes_json.rs @@ -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, + cubes: IndexMap, movement: HashMap, lerp_value: f32, battle: BattleConfig, @@ -326,7 +327,7 @@ impl super::ConfigProvider for CubeConfig { crate::factory::Factory::from_config(&self.factory).await } - fn cubes(&self) -> &'_ std::collections::HashMap { + fn cubes(&self) -> &'_ indexmap::IndexMap { &self.cubes } diff --git a/rc_core/src/persist/config/traits.rs b/rc_core/src/persist/config/traits.rs index 2bc92cf..b7a7e38 100644 --- a/rc_core/src/persist/config/traits.rs +++ b/rc_core/src/persist/config/traits.rs @@ -22,7 +22,7 @@ pub trait ConfigProvider { fn server_config(&self) -> ServerConfig; fn garage_upgrades(&self) -> GarageUpgrades; async fn factory(&self) -> Result>; - fn cubes(&self) -> &'_ std::collections::HashMap; + fn cubes(&self) -> &'_ indexmap::IndexMap; fn chat_system_config(&self) -> ChatSystemConfig; fn gamemode_events(&self) -> GameEventSequence; fn gamemodes(&self) -> crate::data::game_mode::GameModeConfigs; // FIXME