Files
war-in-tunnels/src/cli.rs
T
GarandPLG 9300eef906 Initialize skirmish board and refactor states
- Create `GameStates` from a `&Cli` and initialize the skirmish board in
  `App::new`.
- Move map dimensions to `SkirmishState` and add a `board_cells` vector
  populated by `CellWidget`s.
- Refactor `SettingsState` to store only user‑specific settings (fields
  are cloned).
- Update `BoardWidget` to hold a reference to the cell vector and use
  the new dimensions.
- Adjust CLI defaults: map width to 50 and map height to 25.
2026-03-27 19:25:20 +01:00

112 lines
2.2 KiB
Rust

use crate::app::{
states::{GameMode, PerkDecks},
view::View,
};
use clap::Parser;
#[derive(Parser, Debug)]
#[command(version, about = "War in Tunnels", long_about = "War in Tunnels")]
pub struct Cli {
#[arg(
long,
help = "Default window",
value_name = "...",
default_value_t = View::MainMenu,
value_enum
)]
pub view: View,
#[arg(
long,
help = "Username",
value_name = "String",
default_value = "Player"
)]
pub username: String,
#[arg(
long,
help = "Game mode",
value_name = "...",
default_value_t = GameMode::LastManStanding,
value_enum
)]
pub game_mode: GameMode,
#[arg(
long,
help = "Map width",
value_name = "Positive integer [20; 100]",
default_value = "50"
)]
pub map_width: u8,
#[arg(
long,
help = "Map height",
value_name = "Positive integer [11; 50]",
default_value = "25"
)]
pub map_height: u8,
#[arg(
long,
help = "Perk Deck",
value_name = "...",
default_value_t = PerkDecks::Silesian,
value_enum
)]
pub perk_deck: PerkDecks,
#[arg(
long,
help = "Starting wood",
value_name = "Positive integer",
default_value = "50"
)]
pub starting_wood: u16,
#[arg(
long,
help = "Starting iron",
value_name = "Positive integer",
default_value = "25"
)]
pub starting_iron: u16,
#[arg(
long,
help = "Supply limit",
value_name = "Positive integer",
default_value = "99"
)]
pub supply_limit: u8,
#[arg(
long,
help = "XP modifier",
value_name = "Float [0.5; 2.0]",
default_value = "1.0"
)]
pub xp_modifier: f32,
#[arg(
long,
help = "Skill points limit",
value_name = "Positive integer [120; 690]",
default_value = "120"
)]
pub skill_points_limit: u16,
#[arg(
long,
help = "Enable logging to file (default: disabled)",
default_value_t = false
)]
pub log: bool,
}
pub fn get_args() -> Cli {
Cli::parse()
}