generated from GarandPLG/rust-flake-template
Add delete flag to end_marking_cells
Pass true when handling the Delete action and false for normal cleanup, updating all call sites to use the new boolean parameter.
This commit is contained in:
@@ -86,7 +86,7 @@ pub fn skirmish_keybindings(app: &mut App, key_event: &KeyEvent) {
|
|||||||
Action::Backspace => board.pop_marked_cell(),
|
Action::Backspace => board.pop_marked_cell(),
|
||||||
Action::Delete => {
|
Action::Delete => {
|
||||||
board.marked_cells.marking_cells = false;
|
board.marked_cells.marking_cells = false;
|
||||||
board.end_marking_cells()
|
board.end_marking_cells(true)
|
||||||
}
|
}
|
||||||
Action::Tab => {
|
Action::Tab => {
|
||||||
states.skirmish.side_panel = !states.skirmish.side_panel;
|
states.skirmish.side_panel = !states.skirmish.side_panel;
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ impl BoardState {
|
|||||||
if self.marked_cells.marking_cells {
|
if self.marked_cells.marking_cells {
|
||||||
self.start_marking_cells();
|
self.start_marking_cells();
|
||||||
} else {
|
} else {
|
||||||
self.end_marking_cells();
|
self.end_marking_cells(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,14 +210,14 @@ impl BoardState {
|
|||||||
self.marked_cells.marked_cells.push_back((row, col));
|
self.marked_cells.marked_cells.push_back((row, col));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn end_marking_cells(&mut self) {
|
pub fn end_marking_cells(&mut self, del: bool) {
|
||||||
for (row, col) in self.marked_cells.marked_cells.clone() {
|
for (row, col) in self.marked_cells.marked_cells.clone() {
|
||||||
self.get_mut_cell(row, col).set_marked(false);
|
self.get_mut_cell(row, col).set_marked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
let (row, col) = self.marked_cells.selected_unit.get_coords();
|
let (row, col) = self.marked_cells.selected_unit.get_coords();
|
||||||
|
|
||||||
if self.marked_cells.marked_cells.len() > 1 {
|
if self.marked_cells.marked_cells.len() > 1 && !del {
|
||||||
let task: Tasks =
|
let task: Tasks =
|
||||||
Tasks::Digging(DiggingTask::new(self.marked_cells.marked_cells.clone()));
|
Tasks::Digging(DiggingTask::new(self.marked_cells.marked_cells.clone()));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user