generated from GarandPLG/rust-flake-template
Add lifetime parameter and MarkedCells struct
Refactor App, GameStates, SkirmishState and BoardState to carry a generic lifetime `'a`. Introduce a new `MarkedCells` type that holds marking state and selected unit, replacing the previous `marking_cells` flag and raw deque. Update related methods, keybindings, view implementations and module exports to use the new structures.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
use crate::app::states::skirmish_states::units::Units;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct MarkedCells<'a> {
|
||||
pub marking_cells: bool,
|
||||
pub marked_cells: VecDeque<(usize, usize)>,
|
||||
pub selected_unit: &'a Option<Units>,
|
||||
}
|
||||
|
||||
impl MarkedCells<'_> {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
marking_cells: false,
|
||||
marked_cells: VecDeque::new(),
|
||||
selected_unit: &None,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user