Add rustfmt configuration and reformat code

- Document new Rust formatting standards in AGENTS, CODE_MAP, and
  PROGRESS.
- Add rustfmt.toml with style 2024, 2‑space indents, 100‑char width, LF
  endings.
- Apply consistent 2‑space indentation and ordering across source files.
- Minor clean‑up of imports and whitespace to match the new style.
This commit is contained in:
GarandPLG committed 2026-10-19 12:21:20 +02:00
1 parent 9e09aaf75e
commit c4313b4117
60 files changed
+3632 -3610

No files matched your search

@@ -1,94 +1,94 @@
use crate::app::states::skirmish_states::{Players, structures::Structure};
use ratatui::{
style::{Color, Stylize},
text::Line,
style::{Color, Stylize},
text::Line,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Ore {
owner: Players,
ore_amount: u16,
durability: u16,
stress: u8,
level: u8,
owner: Players,
ore_amount: u16,
durability: u16,
stress: u8,
level: u8,
}
impl Ore {
pub fn new(owner: Players, level: u8) -> Self {
Self {
owner,
ore_amount: 5000,
durability: 1000,
stress: 0,
level,
}
pub fn new(owner: Players, level: u8) -> Self {
Self {
owner,
ore_amount: 5000,
durability: 1000,
stress: 0,
level,
}
}
pub fn get_ore_amount(&self) -> u16 {
self.ore_amount
}
pub fn get_ore_amount(&self) -> u16 {
self.ore_amount
}
pub fn get_max_ore_amount(&self) -> u16 {
5000
}
pub fn get_max_ore_amount(&self) -> u16 {
5000
}
pub fn set_owner(&mut self, new_owner: Players) -> &mut Self {
self.owner = new_owner;
self
}
pub fn set_owner(&mut self, new_owner: Players) -> &mut Self {
self.owner = new_owner;
self
}
}
impl Structure for Ore {
fn get_tag(&self) -> char {
'O'
fn get_tag(&self) -> char {
'O'
}
fn get_color(&self) -> Color {
match self.owner {
Players::Player => self.owner.get_color(),
Players::Enemy => self.owner.get_color(),
Players::Unclaimed => Color::Indexed(217),
}
}
fn get_color(&self) -> Color {
match self.owner {
Players::Player => self.owner.get_color(),
Players::Enemy => self.owner.get_color(),
Players::Unclaimed => Color::Indexed(217),
}
fn get_durability(&self) -> u16 {
self.durability
}
fn get_level(&self) -> char {
if self.level != 0 {
(self.level + b'0') as char
} else {
' '
}
}
fn get_durability(&self) -> u16 {
self.durability
}
fn get_max_durability(&self) -> u16 {
1000
}
fn get_level(&self) -> char {
if self.level != 0 {
(self.level + b'0') as char
} else {
' '
}
}
fn get_name(&self) -> &'static str {
"Ore"
}
fn get_max_durability(&self) -> u16 {
1000
}
fn get_owner(&self) -> Players {
self.owner
}
fn get_name(&self) -> &'static str {
"Ore"
}
fn get_stress(&self) -> u8 {
self.stress
}
fn get_owner(&self) -> Players {
self.owner
}
fn text(&self) -> Vec<Line<'_>> {
let mut lines: Vec<Line<'_>> = Structure::base_text(self);
fn get_stress(&self) -> u8 {
self.stress
}
lines.push(Line::from_iter([
"Ore: ".gray(),
self.get_ore_amount().to_string().cyan(),
"/".gray(),
self.get_max_ore_amount().to_string().cyan(),
]));
fn text(&self) -> Vec<Line<'_>> {
let mut lines: Vec<Line<'_>> = Structure::base_text(self);
lines.push(Line::from_iter([
"Ore: ".gray(),
self.get_ore_amount().to_string().cyan(),
"/".gray(),
self.get_max_ore_amount().to_string().cyan(),
]));
lines
}
lines
}
}