generated from GarandPLG/rust-flake-template
Show unit task queue and mark in side panel
Add `get_tasks` to the `Unit` trait and implement it for `MinerUnit`, `Units` enum and `Option<Units>`. Use the new method in `base_text` to display a “Tasks Queue” line. Refactor task assignment in `BoardState` to a chained call. Update the skirmish view and `SidePanelWidget` to pass a flag indicating whether the displayed unit is the currently marked one, and highlight the unit name accordingly.
This commit is contained in:
1 parent
a7d8823bf2
commit
e4728aab5d
6 files changed
+41
-5
No files matched your search
@@ -132,11 +132,17 @@ pub fn skirmish_view(app: &App, area: Rect, buf: &mut Buffer) {
|
||||
if states.skirmish.side_panel {
|
||||
let row: usize = board.get_focused_cell().get_row();
|
||||
let col: usize = board.get_focused_cell().get_col();
|
||||
let mut is_unit_marked: bool = false;
|
||||
|
||||
if let Some((first_row, first_col)) = board.marked_cells.marked_cells.get(0) {
|
||||
is_unit_marked = first_row == &row && first_col == &col;
|
||||
}
|
||||
|
||||
SidePanelWidget::new(
|
||||
(row, col),
|
||||
&board.get_ref_cell(row, col).get_structure(),
|
||||
&board.get_ref_cell(row, col).get_option_unit(),
|
||||
&board.get_ref_cell(row, col).get_ref_option_unit(),
|
||||
is_unit_marked,
|
||||
)
|
||||
.render(side_panel_area, buf);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user