Add comprehensive CLI options for game settings

- Expanded `Cli` with arguments for username, game mode, map size, perk
  deck, resources, supply limit, XP modifier, and skill points limit.
- Enabled the `cli` module in `lib.rs` and activated argument parsing in
  `main.rs`.
- Added placeholder (commented) fields to `App` for future configuration
  integration.
This commit is contained in:
2026-03-09 16:54:10 +01:00
parent e98f1ddc24
commit a9b84bbe0f
5 changed files with 49 additions and 11 deletions
+10
View File
@@ -7,6 +7,16 @@ use std::{
pub struct App {
pub exit: bool,
// pub username: String,
// pub game_mode: String,
// pub map_width: u8,
// pub map_height: u8,
// pub perk_deck: String,
// pub starting_wood: u8,
// pub starting_iron: u8,
// pub supply_limit: u8,
// pub xp_modifier: f32,
// pub skill_points_limit: u16,
}
pub enum Event {
+35 -1
View File
@@ -2,7 +2,41 @@ use clap::Parser;
#[derive(Parser, Debug)]
#[command(version, about = "War in Tunnels", long_about = "War in Tunnels")]
pub struct Cli {}
pub struct Cli {
#[arg(long, help = "Username", value_name = "String")]
pub username: String,
#[arg(long, help = "Game mode", value_name = "LastManStanding or FrontLines")]
pub game_mode: String,
#[arg(long, help = "Map width", value_name = "Positive integer [20; 100]")]
pub map_width: u8,
#[arg(long, help = "Map height", value_name = "Positive integer [11; 50]")]
pub map_height: u8,
#[arg(long, help = "Perk Deck", value_name = "String (check Perk Deck tab)")]
pub perk_deck: String,
#[arg(long, help = "Starting wood", value_name = "Positive integer")]
pub starting_wood: u8,
#[arg(long, help = "Starting iron", value_name = "Positive integer")]
pub starting_iron: u8,
#[arg(long, help = "Supply limit", value_name = "Positive integer")]
pub supply_limit: u8,
#[arg(long, help = "XP modifier", value_name = "Float [0.5; 2.0]")]
pub xp_modifier: f32,
#[arg(
long,
help = "Skill points limit",
value_name = "Positive integer [120; 690]"
)]
pub skill_points_limit: u16,
}
pub fn get_args() -> Cli {
Cli::parse()
+1 -1
View File
@@ -1,2 +1,2 @@
pub mod app;
// pub mod cli;
pub mod cli;
+2 -2
View File
@@ -6,11 +6,11 @@ use std::{
};
use war_in_tunnels::{
app::{App, Event, handle_input_events},
// cli::{Cli, get_args},
cli::{Cli, get_args},
};
fn main() -> Result<()> {
// let args: Cli = get_args();
let args: Cli = get_args();
let mut terminal: Terminal<CrosstermBackend<Stdout>> = ratatui::init();
let mut app: App = App { exit: false };
+1 -7
View File
@@ -1,9 +1,3 @@
Ant (rozbudowa bazy)
Mole (kopanie tuneli)
Scorpion (walka z przeciwnikiem)
Trapdoor (infiltracja wrogich tuneli)
Bombardier (wysadzanie / materiały wybuchowe)
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐│
││War in Tunnels ││
@@ -13,7 +7,7 @@ Bombardier (wysadzanie / materiały wybuchowe)
││ ││
││ ┌─────┬──────┬──────────┬──────────┬────────────┐ ┌─[A]──────────────────────────────────┐ ││
││ │ Ant │ Mole │ Scorpion │ Trapdoor │ Bombardier │ │ │ ││
││ │ └──────┴──────────┴──────────┴────────────┴────────┐ │ Basic (+): │ ││
││ ├─────┘ └──────────┴──────────┴────────────┴────────┐ │ Basic (+): │ ││
││ │ │ │ │ ││
││ │ 18 ┌─────┐ │ ┌─────┐ │ ┌─────┐ │ │ ---------------------------------- │ ││
││ │ │ │ │ │ │ │ │ │ │ │ ---------------------------------- │ ││