generated from GarandPLG/rust-flake-template
Add tab navigation for building and recruitment UI
- Add selection indices and option lists to SkirmishState. - Implement `cycle_popup_option` and expose Left/Right actions in keybindings. - Introduce `cancel_focused_tasks` in BoardState for Delete handling. - CellWidget now displays recruitment progress on Base structures. - Update README and documentation to describe new tabs and arrow navigation. - Adjust test counts and add extensive task‑cancellation tests.
This commit is contained in:
1 parent
6c1141a711
commit
110d4c411a
16 files changed
+546
-48
No files matched your search
@@ -500,6 +500,25 @@ impl BoardState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cancel_focused_tasks(&mut self, all: bool) -> bool {
|
||||
if self.marked_cells.marking_cells {
|
||||
return false;
|
||||
}
|
||||
let (row, col): (usize, usize) = self.focused_cell.get_coords();
|
||||
let Some(unit) = self.cells[row][col].get_mut_option_unit().as_mut() else {
|
||||
return false;
|
||||
};
|
||||
if unit.get_owner() != Players::Player || unit.get_ref_tasks().is_empty() {
|
||||
return false;
|
||||
}
|
||||
if all {
|
||||
unit.get_mut_tasks().clear();
|
||||
} else {
|
||||
unit.get_mut_tasks().pop_back();
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub fn advance_turn(&mut self) {
|
||||
// Snapshot positions so moving to a later cell cannot grant another turn.
|
||||
let active: Vec<(usize, usize)> = self
|
||||
|
||||
Reference in new issue
Block a user