Use VecDeque for tasks and marked cells

Replace `Vec` with `VecDeque` in `BoardState` marked cells,
`DiggingTask` path,
and `MinerUnit` tasks to enable efficient push/pop operations. Remove
the
`Copy` trait from several structs and enums, adjust derives accordingly,
and
use `as_ref` in `Option<Units>` implementations to avoid consuming the
option.
Update cell rendering to clone widgets and adjust
`CellWidget::get_option_unit`
to return a cloned `Option<Units>`. Add necessary `VecDeque` imports.
This commit is contained in:
2026-05-06 20:01:49 +02:00
parent 41020708e4
commit b66c1d8e25
7 changed files with 29 additions and 28 deletions
@@ -1,12 +1,13 @@
use crate::app::states::skirmish_states::{Players, tasks::Tasks, units::Unit};
use std::collections::VecDeque;
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, PartialEq)]
pub struct MinerUnit {
owner: Players,
hp: u16,
can_dig: bool,
digging_power: f32,
// tasks: Vec<Tasks>,
pub tasks: VecDeque<Tasks>,
}
impl MinerUnit {
@@ -16,7 +17,7 @@ impl MinerUnit {
hp: 100,
can_dig: true,
digging_power: 0.55,
// tasks: Vec::new(),
tasks: VecDeque::new(),
}
}
}