generated from GarandPLG/rust-flake-template
Add Building and Unit structs, extend CellWidget
Introduce empty Building and Unit types and expose them through new modules. Extend CellWidget to store optional Unit and Building, update its constructor, and adjust board rendering to create cells with these new fields (currently always None).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::app::states::ZoomLevel;
|
||||
use crate::app::{buildings::Building, states::ZoomLevel, units::Unit};
|
||||
use ratatui::{
|
||||
buffer::Buffer,
|
||||
layout::{Alignment, Rect},
|
||||
@@ -28,6 +28,8 @@ pub struct CellWidget {
|
||||
zoom_level: ZoomLevel,
|
||||
tag: CellTag,
|
||||
marked: bool,
|
||||
unit: Option<Unit>,
|
||||
building: Option<Building>,
|
||||
}
|
||||
|
||||
impl CellWidget {
|
||||
@@ -37,6 +39,8 @@ impl CellWidget {
|
||||
zoom_level: ZoomLevel,
|
||||
selected: bool,
|
||||
tag: CellTag,
|
||||
unit: Option<Unit>,
|
||||
building: Option<Building>,
|
||||
) -> Self {
|
||||
Self {
|
||||
row,
|
||||
@@ -45,6 +49,8 @@ impl CellWidget {
|
||||
zoom_level,
|
||||
tag,
|
||||
marked: false,
|
||||
unit,
|
||||
building,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user