From 1a2376931b718b546a0b439af6dd66871775b893 Mon Sep 17 00:00:00 2001 From: Sofia Date: Mon, 3 Aug 2026 21:45:39 +0300 Subject: [PATCH] Order game options by key --- rust/src/game/opts.rs | 6 +++--- rust/src/ui/lobby.rs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rust/src/game/opts.rs b/rust/src/game/opts.rs index 084794e..4d70469 100644 --- a/rust/src/game/opts.rs +++ b/rust/src/game/opts.rs @@ -97,7 +97,7 @@ impl GameOptions { } } -#[derive(Debug, PartialEq, Eq, PartialOrd, Hash, Copy, Clone, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Hash, Copy, Clone, Serialize, Deserialize, Ord)] pub enum GameOption { /// Allow anyone to select a map, not just the host AllowAnyMap, @@ -107,12 +107,12 @@ pub enum GameOption { FriendlyFire, /// The number of goals needed to win a match GoalsNeededToWin, - /// Whether telegrenades are allowed or not. - TelegrenadesAllowed, /// How long in seconds does it take for a player to respawn RespawnTimer, /// How long in seconds is spawn protected SpawnProtection, + /// Whether telegrenades are allowed or not. + TelegrenadesAllowed, /// Whether pickups are allowed PickupsAllowed, } diff --git a/rust/src/ui/lobby.rs b/rust/src/ui/lobby.rs index f20596b..6b0f481 100644 --- a/rust/src/ui/lobby.rs +++ b/rust/src/ui/lobby.rs @@ -464,7 +464,11 @@ impl LobbyPanel { team: Option, ) -> Vec> { let mut nodes = Vec::new(); - for (option, value) in opts { + + let mut keys = opts.keys().collect::>(); + keys.sort(); + for option in keys { + let value = opts.get(option).unwrap(); let mut label = Label::new_alloc(); label.set_text(&format!("{}:", option.to_string())); nodes.push(label.upcast());