Replace settings module with skirmish mode

Removed the settings UI and its keybinding logic, added a skirmish view
and corresponding keybindings, simplified the SettingsState to hold
skirmish configuration, updated module exports, and changed the CLI
default map height from 25 to 21. Also fixed the main menu selection
limit.
This commit is contained in:
2026-03-17 14:28:46 +01:00
parent aaa2c90426
commit 0577697059
14 changed files with 149 additions and 355 deletions
+2 -2
View File
@@ -6,6 +6,6 @@ pub mod skirmish;
pub use main_menu::MainMenuState;
pub use perk_decks::{PerkDecks, PerkDecksState};
pub use settings::{GameMode, SettingsOption, SettingsState, SettingsValue};
pub use settings::SettingsState;
pub use skills_config::SkillsConfigState;
pub use skirmish::SkirmishState;
pub use skirmish::{GameMode, SkirmishState};
+11 -54
View File
@@ -1,58 +1,15 @@
use crate::app::states::PerkDecks;
use clap::ValueEnum;
use std::fmt::Display;
use crate::app::states::{GameMode, PerkDecks};
#[derive(Debug, Clone, PartialEq)]
pub struct SettingsState {
pub id: usize,
pub name: &'static str,
pub selected_setting: usize,
pub show_popup: bool,
pub selected_setting_new_value: String,
pub error_message: String,
pub options: Vec<SettingsOption>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct SettingsOption {
pub name: &'static str,
pub value: SettingsValue,
}
#[derive(Debug, Clone, PartialEq)]
pub enum SettingsValue {
U8(u8),
F32(f32),
U16(u16),
Text(String),
GameMode(GameMode),
PerkDeck(PerkDecks),
}
impl Display for SettingsValue {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
SettingsValue::U8(v) => write!(f, "{}", v),
SettingsValue::F32(v) => write!(f, "{}", v),
SettingsValue::U16(v) => write!(f, "{}", v),
SettingsValue::Text(v) => write!(f, "{}", v),
SettingsValue::GameMode(v) => write!(f, "{}", v),
SettingsValue::PerkDeck(v) => write!(f, "{}", v),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
pub enum GameMode {
LastManStanding,
FrontLines,
}
impl Display for GameMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
GameMode::FrontLines => write!(f, "Front Lines"),
GameMode::LastManStanding => write!(f, "Last Man Standing"),
}
}
pub username: String,
pub game_mode: GameMode,
pub map_width: u8,
pub map_height: u8,
pub perk_deck: PerkDecks,
pub starting_wood: u16,
pub starting_iron: u16,
pub supply_limit: u8,
pub xp_modifier: f32,
pub skill_points_limit: u16,
}
+8
View File
@@ -1,5 +1,13 @@
use clap::ValueEnum;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct SkirmishState {
pub id: usize,
pub name: &'static str,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
pub enum GameMode {
LastManStanding,
FrontLines,
}