Move buildings and units under skirmish_states

Reorganize the codebase by moving the buildings and units modules
into the skirmish_states namespace, updating imports accordingly.
This commit is contained in:
2026-04-19 18:02:36 +02:00
parent 6a43b28e67
commit 54e86b2688
8 changed files with 4 additions and 6 deletions
+1 -3
View File
@@ -1,11 +1,9 @@
use crate::app::{
buildings::BaseBuilding,
helpers::{CellSizes, cell_size_helper, cells_area_helper},
states::{
CellStructure, FocusedCell, Offset, Players, Units, ZoomLevel,
skirmish_states::MoveFocusedCell,
skirmish_states::{MoveFocusedCell, buildings::BaseBuilding, units::MinerUnit},
},
units::MinerUnit,
widgets::CellWidget,
};
use ratatui::layout::Rect;
@@ -0,0 +1,35 @@
use crate::app::states::Players;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BaseBuilding {
owner: Players,
level: u8,
tag: &'static str,
}
impl BaseBuilding {
pub fn new(owner: Players) -> Self {
Self {
owner,
level: 1,
tag: "B",
}
}
pub fn get_owner(&self) -> Players {
self.owner
}
pub fn get_tag(&self) -> &'static str {
self.tag
}
pub fn get_level(&self) -> &'static str {
match self.level {
1 => "1",
2 => "2",
3 => "3",
_ => " ",
}
}
}
@@ -0,0 +1,3 @@
mod base;
pub use base::BaseBuilding;
+2
View File
@@ -1,6 +1,8 @@
mod board;
pub mod buildings;
mod focused_cell;
mod offset;
pub mod units;
pub use board::BoardState;
pub use focused_cell::{FocusedCell, MoveFocusedCell};
@@ -0,0 +1,17 @@
use crate::app::states::Players;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct MinerUnit {
owner: Players,
tag: &'static str,
}
impl MinerUnit {
pub fn new(owner: Players) -> Self {
Self { owner, tag: "M" }
}
pub fn get_tag(self) -> &'static str {
self.tag
}
}
@@ -0,0 +1,3 @@
mod miner;
pub use miner::MinerUnit;