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:
@@ -220,9 +220,10 @@ impl BoardState {
|
||||
|
||||
let (row, col) = self.marked_cells.selected_unit.get_coords();
|
||||
let task: Tasks = Tasks::Digging(DiggingTask::new(self.marked_cells.marked_cells.clone()));
|
||||
let unit: &mut Option<Units> = self.get_mut_cell(row, col).get_mut_option_unit();
|
||||
|
||||
unit.set_task(task);
|
||||
self.get_mut_cell(row, col)
|
||||
.get_mut_option_unit()
|
||||
.set_task(task);
|
||||
|
||||
self.marked_cells.selected_unit = None;
|
||||
self.marked_cells.marked_cells.clear();
|
||||
|
||||
Reference in New Issue
Block a user