Refactor buildings/units, move CellTag & Players

Introduce BaseBuilding struct. Rename Building and Unit to enum types
(Buildings, Units). Move CellTag and Players enums to the skirmish state
module and update imports and re‑exports accordingly. Add placeholder
miner module.
This commit is contained in:
GarandPLG committed 2026-04-15 13:21:39 +02:00
1 parent 44d29bd3ad
commit be41936f14
11 files changed
+38 -26

No files matched your search

+9 -18
View File
@@ -1,4 +1,8 @@
use crate::app::{buildings::Building, states::ZoomLevel, units::Unit};
use crate::app::{
buildings::Buildings,
states::{CellTag, Players, ZoomLevel},
units::Units,
};
use ratatui::{
buffer::Buffer,
layout::{Alignment, Rect},
@@ -7,19 +11,6 @@ use ratatui::{
widgets::{Block, Borders, Paragraph, Widget},
};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CellTag {
Base(Players),
Tunel,
Stone,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Players {
Player,
Enemy,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CellWidget {
row: usize,
@@ -28,8 +19,8 @@ pub struct CellWidget {
zoom_level: ZoomLevel,
tag: CellTag,
marked: bool,
unit: Option<Unit>,
building: Option<Building>,
unit: Option<Units>,
building: Option<Buildings>,
}
impl CellWidget {
@@ -39,8 +30,8 @@ impl CellWidget {
zoom_level: ZoomLevel,
selected: bool,
tag: CellTag,
unit: Option<Unit>,
building: Option<Building>,
unit: Option<Units>,
building: Option<Buildings>,
) -> Self {
Self {
row,