Order game options by key

This commit is contained in:
Sofia 2026-08-03 21:45:39 +03:00
parent d0b3586f6b
commit 1a2376931b
2 changed files with 8 additions and 4 deletions

View File

@ -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 { pub enum GameOption {
/// Allow anyone to select a map, not just the host /// Allow anyone to select a map, not just the host
AllowAnyMap, AllowAnyMap,
@ -107,12 +107,12 @@ pub enum GameOption {
FriendlyFire, FriendlyFire,
/// The number of goals needed to win a match /// The number of goals needed to win a match
GoalsNeededToWin, GoalsNeededToWin,
/// Whether telegrenades are allowed or not.
TelegrenadesAllowed,
/// How long in seconds does it take for a player to respawn /// How long in seconds does it take for a player to respawn
RespawnTimer, RespawnTimer,
/// How long in seconds is spawn protected /// How long in seconds is spawn protected
SpawnProtection, SpawnProtection,
/// Whether telegrenades are allowed or not.
TelegrenadesAllowed,
/// Whether pickups are allowed /// Whether pickups are allowed
PickupsAllowed, PickupsAllowed,
} }

View File

@ -464,7 +464,11 @@ impl LobbyPanel {
team: Option<u8>, team: Option<u8>,
) -> Vec<Gd<Control>> { ) -> Vec<Gd<Control>> {
let mut nodes = Vec::new(); let mut nodes = Vec::new();
for (option, value) in opts {
let mut keys = opts.keys().collect::<Vec<_>>();
keys.sort();
for option in keys {
let value = opts.get(option).unwrap();
let mut label = Label::new_alloc(); let mut label = Label::new_alloc();
label.set_text(&format!("{}:", option.to_string())); label.set_text(&format!("{}:", option.to_string()));
nodes.push(label.upcast()); nodes.push(label.upcast());