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:
GarandPLG committed 2026-04-13 21:27:44 +02:00
1 parent 1393f282e8
commit 44d29bd3ad
7 files changed
+26 -4

No files matched your search

+7 -3
View File
@@ -57,16 +57,20 @@ impl BoardState {
for col in 0..map_width {
let selected: bool = row == focused_cell.get_row() && col == focused_cell.get_col();
let player_base: bool = row == player_base_coords.0 && col == player_base_coords.1;
let enemy_base: bool = row == enemy_base_coords.0 && col == enemy_base_coords.1;
let tag: CellTag = if row == player_base_coords.0 && col == player_base_coords.1 {
let tag: CellTag = if player_base {
CellTag::Base(Players::Player)
} else if row == enemy_base_coords.0 && col == enemy_base_coords.1 {
} else if enemy_base {
CellTag::Base(Players::Enemy)
} else {
CellTag::Stone
};
rows.push(CellWidget::new(row, col, zoom_level, selected, tag));
rows.push(CellWidget::new(
row, col, zoom_level, selected, tag, None, None,
));
}
cells.push(rows);